<!DOCTYPE html><html lang="zh-CN" data-theme="dark"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>uniapp开发,遇坑填坑 😘 | 前端攻城狮ZhuoRu</title><meta name="keywords" content="张卓如,web,前端,uniapp"><meta name="author" content="ZhuoRu"><meta name="copyright" content="ZhuoRu"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#0d0d0d"><meta name="baidu-site-verification" content="code-0ABMo98myg"><meta name="description" content="2020年接手uniapp开发,个人总结">
<meta property="og:type" content="article">
<meta property="og:title" content="uniapp开发,遇坑填坑 😘">
<meta property="og:url" content="https://zhangzhuoru.gitee.io/web/post/11314.html">
<meta property="og:site_name" content="前端攻城狮ZhuoRu">
<meta property="og:description" content="2020年接手uniapp开发,个人总结">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://zhangzhuoru.gitee.io/web/img/tab5.png">
<meta property="article:published_time" content="2022-11-26T16:31:04.746Z">
<meta property="article:modified_time" content="2020-05-22T16:27:23.000Z">
<meta property="article:author" content="ZhuoRu">
<meta property="article:tag" content="uniapp">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://zhangzhuoru.gitee.io/web/img/tab5.png"><link rel="shortcut icon" href="/web/img/favicon.png"><link rel="canonical" href="https://zhangzhuoru.gitee.io/web/post/11314"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/web/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = { 
  root: '/web/',
  algolia: undefined,
  localSearch: {"path":"search.xml","languages":{"hits_empty":"找不到您查询的内容：${query}"}},
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":500},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '天',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: {"limitCount":50,"languages":{"author":"作者: ZhuoRu","link":"链接: ","source":"来源: 前端攻城狮ZhuoRu","info":"著作权归作者所有。商业转载请联系作者获得授权，非商业转载请注明出处。"}},
  lightbox: 'fancybox',
  Snackbar: {"chs_to_cht":"你已切换为繁体","cht_to_chs":"你已切换为简体","day_to_night":"你已切换为深色模式","night_to_day":"你已切换为浅色模式","bgLight":"#49b1f5","bgDark":"#121212","position":"top-right"},
  source: {
    jQuery: 'https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js',
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/js/jquery.justifiedGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/css/justifiedGallery.min.css'
    },
    fancybox: {
      js: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.js',
      css: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css'
    }
  },
  isPhotoFigcaption: true,
  islazyload: true,
  isanchor: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = { 
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2020-05-23 00:27:23'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    })(window)</script><link rel="stylesheet" href="./css/custom.css"><link rel="stylesheet" href="https://fastly.jsdelivr.net/gh/tzy13755126023/BLOG_SOURCE/css/function.min.css"><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css" media="defer" onload="this.media='all'"><link rel="stylesheet" href="https://fastly.jsdelivr.net/gh/l-lin/font-awesome-animation/dist/font-awesome-animation.min.css"  media="defer" onload="this.media='all'"><svg aria-hidden="true" style="position:absolute; overflow:hidden; width:0; height:0"><symbol id="icon-sun" viewBox="0 0 1024 1024"><path d="M611.370667 167.082667a445.013333 445.013333 0 0 1-38.4 161.834666 477.824 477.824 0 0 1-244.736 244.394667 445.141333 445.141333 0 0 1-161.109334 38.058667 85.077333 85.077333 0 0 0-65.066666 135.722666A462.08 462.08 0 1 0 747.093333 102.058667a85.077333 85.077333 0 0 0-135.722666 65.024z" fill="#FFB531" p-id="11345"></path><path d="M329.728 274.133333l35.157333-35.157333a21.333333 21.333333 0 1 0-30.165333-30.165333l-35.157333 35.157333-35.114667-35.157333a21.333333 21.333333 0 0 0-30.165333 30.165333l35.114666 35.157333-35.114666 35.157334a21.333333 21.333333 0 1 0 30.165333 30.165333l35.114667-35.157333 35.157333 35.157333a21.333333 21.333333 0 1 0 30.165333-30.165333z" fill="#030835" p-id="11346"></path></symbol><symbol id="icon-moon" viewBox="0 0 1024 1024"><path d="M611.370667 167.082667a445.013333 445.013333 0 0 1-38.4 161.834666 477.824 477.824 0 0 1-244.736 244.394667 445.141333 445.141333 0 0 1-161.109334 38.058667 85.077333 85.077333 0 0 0-65.066666 135.722666A462.08 462.08 0 1 0 747.093333 102.058667a85.077333 85.077333 0 0 0-135.722666 65.024z" fill="#FFB531" p-id="11345"></path><path d="M329.728 274.133333l35.157333-35.157333a21.333333 21.333333 0 1 0-30.165333-30.165333l-35.157333 35.157333-35.114667-35.157333a21.333333 21.333333 0 0 0-30.165333 30.165333l35.114666 35.157333-35.114666 35.157334a21.333333 21.333333 0 1 0 30.165333 30.165333l35.114667-35.157333 35.157333 35.157333a21.333333 21.333333 0 1 0 30.165333-30.165333z" fill="#030835" p-id="11346"></path></symbol></svg><!-- hexo injector head_end start --><link rel="stylesheet" href="https://npm.elemecdn.com/hexo-butterfly-swiper/lib/swiper.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://npm.elemecdn.com/hexo-butterfly-swiper/lib/swiperstyle.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://npm.elemecdn.com/hexo-butterfly-tag-plugins-plus@latest/lib/assets/font-awesome-animation.min.css" media="defer" onload="this.media='all'"><link rel="stylesheet" href="https://npm.elemecdn.com/hexo-butterfly-tag-plugins-plus@latest/lib/tag_plugins.css" media="defer" onload="this.media='all'"><script src="https://npm.elemecdn.com/hexo-butterfly-tag-plugins-plus@latest/lib/assets/carousel-touch.js"></script><!-- hexo injector head_end end --><meta name="generator" content="Hexo 5.4.2"></head><body><div id="loading-box"><div class="pokeball-back"></div><div class="pokeball-loading"><div class="pokeball" id="pokeball-normal"></div><div class="pokeball" id="pokeball-great"></div><div class="pokeball" id="pokeball-ultra"></div><div class="pokeball" id="pokeball-master"></div><div class="pokeball" id="pokeball-safari"></div></div></div><div id="web_bg"></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="author-avatar"><img class="avatar-img" data-lazy-src="https://thirdqq.qlogo.cn/g?b=sdk&amp;nk=2276839311&amp;s=140" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data"><div class="data-item is-center"><div class="data-item-link"><a href="/web/archives/"><div class="headline">文章</div><div class="length-num">8</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/web/tags/"><div class="headline">标签</div><div class="length-num">9</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/web/categories/"><div class="headline">分类</div><div class="length-num">5</div></a></div></div></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/web/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/web/archives/"><i class="fa-fw fa fa-graduation-cap"></i><span> 博文</span></a></div><div class="menus_item"><a class="site-page" href="/web/sponsorWall/"><i class="fa-fw fas fa-images"></i><span> 赞助墙</span></a></div><div class="menus_item"><a class="site-page" href="/web/comment/"><i class="fa-fw fa fa-paper-plane"></i><span> 留言板</span></a></div><div class="menus_item"><a class="site-page" href="/web/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/web/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div><div class="menus_item"><a class="site-page" href="/web/other/"><i class="fa-fw fas fa-coffee"></i><span> Demo</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url('/web/img/tab5.png')"><nav id="nav"><span id="blog_name"><a id="site-name" href="/web/">前端攻城狮ZhuoRu</a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search"><i class="fas fa-search fa-fw"></i><span> 搜索</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/web/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/web/archives/"><i class="fa-fw fa fa-graduation-cap"></i><span> 博文</span></a></div><div class="menus_item"><a class="site-page" href="/web/sponsorWall/"><i class="fa-fw fas fa-images"></i><span> 赞助墙</span></a></div><div class="menus_item"><a class="site-page" href="/web/comment/"><i class="fa-fw fa fa-paper-plane"></i><span> 留言板</span></a></div><div class="menus_item"><a class="site-page" href="/web/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/web/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div><div class="menus_item"><a class="site-page" href="/web/other/"><i class="fa-fw fas fa-coffee"></i><span> Demo</span></a></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">uniapp开发,遇坑填坑 😘</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2022-11-26T16:31:04.746Z" title="发表于 2022-11-27 00:31:04">2022-11-27</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2020-05-22T16:27:23.000Z" title="更新于 2020-05-23 00:27:23">2020-05-23</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/web/categories/%E7%BB%8F%E9%AA%8C%E8%AE%B0%E5%BD%95/">经验记录</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-wordcount"><i class="far fa-file-word fa-fw post-meta-icon"></i><span class="post-meta-label">字数总计:</span><span class="word-count">5.1k</span><span class="post-meta-separator">|</span><i class="far fa-clock fa-fw post-meta-icon"></i><span class="post-meta-label">阅读时长:</span><span>24分钟</span></span><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="uniapp开发,遇坑填坑 😘"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h1 id="登录输入框样式"><a href="#登录输入框样式" class="headerlink" title="登录输入框样式"></a>登录输入框样式</h1><figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">&quot;login_input&quot;</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">image</span> <span class="attr">src</span>=<span class="string">&quot;../static/images/common/phone.png&quot;</span> &gt;</span><span class="tag">&lt;/<span class="name">image</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">input</span> <span class="attr">type</span>=<span class="string">&quot;number&quot;</span> <span class="attr">placeholder</span>=<span class="string">&quot;请输入您的手机号码&quot;</span> <span class="attr">v-model</span>=<span class="string">&quot;phone&quot;</span> <span class="attr">class</span>=<span class="string">&quot;inputnone&quot;</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">&quot;login_input&quot;</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">image</span> <span class="attr">src</span>=<span class="string">&quot;../static/images/common/lock.png&quot;</span> &gt;</span><span class="tag">&lt;/<span class="name">image</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">input</span> <span class="attr">type</span>=<span class="string">&quot;number&quot;</span> <span class="attr">placeholder</span>=<span class="string">&quot;请输入短信验证码&quot;</span> <span class="attr">v-model</span>=<span class="string">&quot;sms_captcha&quot;</span> <span class="attr">class</span>=<span class="string">&quot;inputnone&quot;</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">&quot;mcsure&quot;</span> <span class="attr">v-if</span>=<span class="string">&#x27;showcount&#x27;</span>&gt;</span></span><br><span class="line">        &#123;&#123;thiscount&#125;&#125;s重新获取</span><br><span class="line">    <span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">&quot;mcsure&quot;</span> @<span class="attr">click</span>=<span class="string">&#x27;checkyzm&#x27;</span> <span class="attr">v-else</span>&gt;</span></span><br><span class="line">        获取验证码</span><br><span class="line">    <span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br></pre></td></tr></table></figure>
<figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br></pre></td><td class="code"><pre><span class="line"><span class="selector-class">.login_input</span>&#123;</span><br><span class="line">    <span class="attribute">margin</span>: <span class="number">0</span> auto;</span><br><span class="line">    <span class="attribute">width</span>: <span class="number">580</span>rpx;</span><br><span class="line">    <span class="attribute">display</span>: flex;</span><br><span class="line">    <span class="attribute">height</span>: <span class="number">100</span>rpx;</span><br><span class="line">    <span class="attribute">border-bottom</span>: <span class="number">2</span>rpx solid <span class="number">#e0e0e0</span>;</span><br><span class="line">    <span class="attribute">line-height</span>: <span class="number">100</span>rpx;</span><br><span class="line">    <span class="attribute">box-sizing</span>: border-box;</span><br><span class="line">&#125;</span><br><span class="line"><span class="selector-class">.login_input</span> <span class="selector-tag">input</span>&#123;</span><br><span class="line">    <span class="attribute">border</span>: none;</span><br><span class="line">    <span class="attribute">background-color</span>: <span class="built_in">hsla</span>(<span class="number">0</span>,<span class="number">0%</span>,<span class="number">100%</span>,<span class="number">0</span>);</span><br><span class="line">    <span class="attribute">height</span>: <span class="number">100</span>rpx;</span><br><span class="line">    <span class="attribute">line-height</span>: <span class="number">100</span>rpx;</span><br><span class="line">    <span class="attribute">font-size</span>: <span class="number">28</span>rpx;</span><br><span class="line">    <span class="attribute">flex</span>: <span class="number">0</span> <span class="number">0</span> <span class="number">300</span>rpx;</span><br><span class="line">&#125;</span><br><span class="line"><span class="selector-class">.login_input</span> image&#123;</span><br><span class="line">    <span class="attribute">margin</span>: <span class="number">32</span>rpx <span class="number">32</span>rpx <span class="number">32</span>rpx <span class="number">0</span> ;</span><br><span class="line">    <span class="attribute">width</span>: <span class="number">32</span>rpx;</span><br><span class="line">    <span class="attribute">height</span>: <span class="number">32</span>rpx;</span><br><span class="line">    <span class="attribute">flex</span>: <span class="number">0</span> <span class="number">0</span> <span class="number">32</span>rpx;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//添加验证码倒计时功能</span></span><br><span class="line"><span class="keyword">async</span> <span class="title function_">checkyzm</span>(<span class="params"></span>)&#123;</span><br><span class="line">    <span class="keyword">if</span> (!<span class="variable language_">this</span>.<span class="property">phone</span>) &#123;</span><br><span class="line">        <span class="variable language_">this</span>.<span class="property">$toast</span>.<span class="title function_">error</span>(<span class="string">&#x27;请输入正确的手机号码&#x27;</span>)</span><br><span class="line">        <span class="keyword">return</span></span><br><span class="line">    &#125;<span class="keyword">else</span>&#123;</span><br><span class="line">        <span class="keyword">let</span> res = <span class="keyword">await</span> <span class="variable language_">this</span>.<span class="property">$API</span>.<span class="property">user</span>.<span class="title function_">sendCaptcha</span>(&#123;</span><br><span class="line">            <span class="attr">phone</span>: <span class="variable language_">this</span>.<span class="property">phone</span></span><br><span class="line">        &#125;)</span><br><span class="line">        <span class="variable language_">this</span>.<span class="property">showcount</span> = <span class="literal">true</span></span><br><span class="line">        <span class="variable language_">this</span>.<span class="property">$toast</span>.<span class="title function_">text</span>(<span class="string">&#x27;短信验证码发送成功&#x27;</span>)</span><br><span class="line">        <span class="variable language_">this</span>.<span class="title function_">startcount</span>()</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">&#125;,</span><br><span class="line"><span class="title function_">startcount</span>(<span class="params"></span>)&#123;</span><br><span class="line">   <span class="keyword">let</span> start=<span class="number">60</span></span><br><span class="line">   <span class="variable language_">this</span>.<span class="property">thiscount</span> = start</span><br><span class="line">   <span class="keyword">let</span> that = <span class="variable language_">this</span></span><br><span class="line">   <span class="keyword">var</span> myVar = <span class="built_in">setInterval</span>(<span class="keyword">function</span>(<span class="params"></span>)&#123;</span><br><span class="line">       that.<span class="property">thiscount</span> = that.<span class="property">thiscount</span> -<span class="number">1</span></span><br><span class="line">       <span class="keyword">if</span>(that.<span class="property">thiscount</span>==<span class="number">0</span>)&#123;</span><br><span class="line">           <span class="built_in">clearInterval</span>(myVar);</span><br><span class="line">           that.<span class="property">showcount</span> = <span class="literal">false</span></span><br><span class="line">       &#125;</span><br><span class="line">   &#125;, <span class="number">1000</span>);</span><br><span class="line">&#125;,</span><br><span class="line"><span class="comment">//登录前做输入检验</span></span><br><span class="line"><span class="title function_">checkForm</span>(<span class="params"></span>) &#123;</span><br><span class="line">    <span class="keyword">if</span> (!<span class="variable language_">this</span>.<span class="property">phone</span>) &#123;</span><br><span class="line">        uni.<span class="title function_">showToast</span>(&#123;</span><br><span class="line">            <span class="attr">title</span>: <span class="string">&#x27;请输入正确的手机号&#x27;</span>,</span><br><span class="line">            <span class="attr">icon</span>: <span class="string">&#x27;none&#x27;</span>,</span><br><span class="line">            <span class="attr">duration</span>: <span class="number">2000</span></span><br><span class="line">        &#125;)</span><br><span class="line">        <span class="keyword">return</span> <span class="literal">false</span></span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">if</span> (!<span class="variable language_">this</span>.<span class="property">sms_captcha</span>) &#123;</span><br><span class="line">        uni.<span class="title function_">showToast</span>(&#123;</span><br><span class="line">            <span class="attr">title</span>: <span class="string">&#x27;请输入正确的验证码&#x27;</span>,</span><br><span class="line">            <span class="attr">icon</span>: <span class="string">&#x27;none&#x27;</span>,</span><br><span class="line">            <span class="attr">duration</span>: <span class="number">2000</span></span><br><span class="line">        &#125;)</span><br><span class="line">        <span class="keyword">return</span> <span class="literal">false</span></span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">else</span>&#123;</span><br><span class="line">        <span class="keyword">const</span> params = &#123;</span><br><span class="line">            <span class="attr">phone</span>: <span class="variable language_">this</span>.<span class="property">phone</span>,</span><br><span class="line">            <span class="attr">sms_captcha</span>: <span class="variable language_">this</span>.<span class="property">sms_captcha</span></span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">return</span> params</span><br><span class="line">    &#125;</span><br><span class="line">&#125;,</span><br><span class="line"><span class="comment">//登录前做弹出框提示</span></span><br><span class="line"><span class="keyword">async</span> <span class="title function_">gotoaddress</span>(<span class="params"></span>) &#123;</span><br><span class="line">     <span class="keyword">const</span> params = <span class="variable language_">this</span>.<span class="title function_">checkForm</span>()</span><br><span class="line">     <span class="keyword">if</span> (!params) <span class="keyword">return</span> <span class="literal">false</span></span><br><span class="line">     <span class="variable language_">this</span>.<span class="property">$global</span>.<span class="title function_">showLoading</span>(&#123; <span class="attr">title</span>: <span class="string">&#x27;登录中&#x27;</span>, <span class="attr">mask</span>: <span class="literal">true</span> &#125;)</span><br><span class="line">     <span class="keyword">try</span> &#123;</span><br><span class="line">         <span class="variable language_">this</span>.<span class="property">news</span> = <span class="keyword">await</span> <span class="variable language_">this</span>.<span class="property">$API</span>.<span class="property">user</span>.<span class="title function_">loginChkLogin</span>(params)</span><br><span class="line">         <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="variable language_">this</span>.<span class="property">news</span>)</span><br><span class="line">         uni.<span class="title function_">switchTab</span>(&#123;</span><br><span class="line">             <span class="attr">url</span>: <span class="string">&#x27;./user/tab_bar/main&#x27;</span></span><br><span class="line">         &#125;)</span><br><span class="line">     &#125; <span class="keyword">finally</span> &#123;</span><br><span class="line">         <span class="variable language_">this</span>.<span class="property">$global</span>.<span class="title function_">hideLoading</span>()</span><br><span class="line">     &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h1 id="倒计时"><a href="#倒计时" class="headerlink" title="倒计时"></a>倒计时</h1><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"><span class="title function_">gotogoodsdetails</span>(<span class="params">id</span>) &#123;</span><br><span class="line">	<span class="keyword">let</span> that = <span class="variable language_">this</span></span><br><span class="line">    <span class="keyword">var</span> myVar = <span class="built_in">setInterval</span>(<span class="keyword">function</span>(<span class="params"></span>)&#123;</span><br><span class="line">        that.<span class="property">showpage</span> = <span class="literal">true</span></span><br><span class="line">        <span class="keyword">var</span> <span class="title class_">EndTime</span>= <span class="keyword">new</span> <span class="title class_">Date</span>(<span class="built_in">parseInt</span>(that.<span class="property">freetime</span>) * <span class="number">1000</span>); <span class="comment">//获取截止时间戳</span></span><br><span class="line">        <span class="keyword">var</span> <span class="title class_">NowTime</span> = <span class="keyword">new</span> <span class="title class_">Date</span>();</span><br><span class="line">        <span class="keyword">var</span> t =<span class="title class_">EndTime</span>.<span class="title function_">getTime</span>() - <span class="title class_">NowTime</span>.<span class="title function_">getTime</span>();</span><br><span class="line">        <span class="keyword">var</span> d=<span class="title class_">Math</span>.<span class="title function_">floor</span>(t/<span class="number">1000</span>/<span class="number">60</span>/<span class="number">60</span>/<span class="number">24</span>);</span><br><span class="line">        <span class="keyword">var</span> h=<span class="title class_">Math</span>.<span class="title function_">floor</span>(t/<span class="number">1000</span>/<span class="number">60</span>/<span class="number">60</span>%<span class="number">24</span>);</span><br><span class="line">        <span class="keyword">var</span> m=<span class="title class_">Math</span>.<span class="title function_">floor</span>(t/<span class="number">1000</span>/<span class="number">60</span>%<span class="number">60</span>);</span><br><span class="line">        <span class="keyword">var</span> s=<span class="title class_">Math</span>.<span class="title function_">floor</span>(t/<span class="number">1000</span>%<span class="number">60</span>);</span><br><span class="line">        that.<span class="property">nowtime</span> = (d*<span class="number">24</span>+h) + <span class="string">&quot; 时 &quot;</span> + m + <span class="string">&quot; 分 &quot;</span> + s + <span class="string">&quot; 秒&quot;</span></span><br><span class="line">        <span class="keyword">if</span>(<span class="title class_">Math</span>.<span class="title function_">floor</span>(t/<span class="number">1000</span>)==<span class="number">0</span>)&#123;<span class="comment">//当倒计时到零时</span></span><br><span class="line">            <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="string">&#x27;myVar&#x27;</span>,myVar)</span><br><span class="line">            <span class="built_in">clearInterval</span>(myVar);</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;, <span class="number">1000</span>);</span><br><span class="line">&#125;,</span><br></pre></td></tr></table></figure>
<h1 id="uniappAndroid微信支付"><a href="#uniappAndroid微信支付" class="headerlink" title="uniappAndroid微信支付"></a>uniappAndroid微信支付</h1><p><img src= "/web/img/loading.gif" data-lazy-src="/img/微信支付报错.jpg" alt="1"></p>
<p><img src= "/web/img/loading.gif" data-lazy-src="/img/微信支付后台填写包名签名.png" alt="2"></p>
<p>前端代码没啥要改的了，就是要在微信支付后台填写包名签名</p>
<p>即生成keystore（证书）文件的工具叫做 keytool，安装java环境应该就有</p>
<p>生成keystore文件命令：<br>keytool -genkey -alias key0 -keyalg RSA -keystore keystore.jks -keysize 2048 -validity 10000</p>
<p>查看keystore文件命令：<br>keytool -list -v -keystore keystore.jks</p>
<p>签名为MD5文字去掉冒号</p>
<p><img src= "/web/img/loading.gif" data-lazy-src="/img/签名.jpg" alt="3"></p>
<p>包名即应用打包的包名</p>
<p><img src= "/web/img/loading.gif" data-lazy-src="/img/包名.png" alt="4"></p>
<h1 id="uniapp阻止事件冒泡-click-stop失效"><a href="#uniapp阻止事件冒泡-click-stop失效" class="headerlink" title="uniapp阻止事件冒泡@click.stop失效"></a>uniapp阻止事件冒泡@click.stop失效</h1><p>配合.native使用：@click.native.stop</p>
<h1 id="关于vue-里-class-的几种使用方式"><a href="#关于vue-里-class-的几种使用方式" class="headerlink" title="关于vue 里:class 的几种使用方式"></a>关于vue 里:class 的几种使用方式</h1><p>以三元表达式来表示class 类名要加’冒号‘</p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">div</span> <span class="attr">:class</span>=<span class="string">&quot;item.functions?&#x27;list_item_name_items&#x27;:&#x27;list_item_name_item&#x27;&quot;</span> <span class="attr">v-if</span>=<span class="string">&quot;item.cn_name&quot;</span>&gt;</span>&#123;&#123; item.cn_name &#125;&#125;<span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br></pre></td></tr></table></figure>
<p>如果存在两个动态class</p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">&quot;allCommon&quot;</span>  <span class="attr">:class</span>=<span class="string">&quot;[_module,&#123;&#x27;takePlace&#x27;:!arr.con.htmlData&#125;]&quot;</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br></pre></td></tr></table></figure>
<h1 id="CSS-伪类-not-用来匹配不符合一组选择器的元素。由于它的作用是防止特定的元素被选中，它也被称为反选伪类（negation-pseudo-class）。"><a href="#CSS-伪类-not-用来匹配不符合一组选择器的元素。由于它的作用是防止特定的元素被选中，它也被称为反选伪类（negation-pseudo-class）。" class="headerlink" title="CSS 伪类 :not() 用来匹配不符合一组选择器的元素。由于它的作用是防止特定的元素被选中，它也被称为反选伪类（negation pseudo-class）。"></a><a target="_blank" rel="noopener" href="https://developer.mozilla.org/zh-CN/docs/Web/CSS">CSS</a> <a target="_blank" rel="noopener" href="https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes">伪类</a> <strong><code>:not()</code></strong> 用来匹配不符合一组选择器的元素。由于它的作用是防止特定的元素被选中，它也被称为<em>反选伪类</em>（<em>negation pseudo-class</em>）。</h1><figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"> &amp;_items<span class="selector-pseudo">:not</span>(<span class="selector-pseudo">:nth-last-child</span>(<span class="number">2</span>))<span class="selector-pseudo">::after</span> &#123;</span><br><span class="line">     <span class="attribute">content</span>: <span class="string">&#x27;/&#x27;</span>;</span><br><span class="line">     <span class="attribute">display</span>: inline;</span><br><span class="line"> &#125;</span><br><span class="line">svg<span class="selector-class">.menu</span> &gt; g<span class="selector-pseudo">:nth-child</span>(<span class="number">1</span>) &gt; path &#123;</span><br><span class="line">    fill: <span class="number">#ffaec9</span>;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h1 id="vue项目中使用scss-sass"><a href="#vue项目中使用scss-sass" class="headerlink" title="vue项目中使用scss/sass"></a>vue项目中使用scss/sass</h1><p>1、安装scss 跟 scss-loader</p>
<blockquote>
<p>npm install scss-loader scss —save-dev</p>
</blockquote>
<figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">&lt;style lang=&quot;scss&quot; scoped&gt;</span><br><span class="line">    <span class="selector-class">.Myfollow</span>&#123;</span><br><span class="line">        <span class="attribute">font-size</span>: <span class="number">2rem</span>;</span><br><span class="line">        <span class="attribute">color</span>: <span class="number">#ff0</span>;</span><br><span class="line">        <span class="selector-class">.text</span>&#123;</span><br><span class="line">            <span class="attribute">color</span>: <span class="number">#000</span>;</span><br><span class="line">            <span class="attribute">font-size</span>: <span class="number">1rem</span>;</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&lt;/style&gt;</span><br></pre></td></tr></table></figure>
<p>2、安装node-sass 跟 sass-loader</p>
<blockquote>
<p>npm install sass-loader node-sass —save-dev</p>
</blockquote>
<figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">&lt;style lang=&quot;sass&quot; scoped&gt;</span><br><span class="line">    <span class="selector-class">.Myfollow</span>&#123;</span><br><span class="line">        <span class="attribute">font-size</span>: <span class="number">2rem</span>;</span><br><span class="line">        <span class="attribute">color</span>: <span class="number">#ff0</span>;</span><br><span class="line">        <span class="selector-class">.text</span>&#123;</span><br><span class="line">            <span class="attribute">color</span>: <span class="number">#000</span>;</span><br><span class="line">            <span class="attribute">font-size</span>: <span class="number">1rem</span>;</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&lt;/style&gt;</span><br></pre></td></tr></table></figure>
<h1 id="JS中find方法"><a href="#JS中find方法" class="headerlink" title="JS中find方法"></a>JS中find方法</h1><h3 id="用法"><a href="#用法" class="headerlink" title="用法"></a>用法</h3><p>1.find() 方法返回通过测试（函数内判断）的数组的第一个元素的值。</p>
<p>2.如果没有符合条件的元素返回 undefined</p>
<p>3.find() 对于空数组，函数是不会执行的。</p>
<p>4.find() 并没有改变数组的原始值。</p>
<p>5.array.find(function(currentValue, index, arr),thisValue)，其中currentValue为当前项，index为当前索引，arr为当前数组</p>
<h3 id="实例"><a href="#实例" class="headerlink" title="实例"></a>实例</h3><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">let</span> test = [<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>];</span><br><span class="line"><span class="keyword">let</span> a = test.<span class="title function_">find</span>(<span class="function"><span class="params">item</span> =&gt;</span> item &gt; <span class="number">3</span>);</span><br><span class="line"><span class="variable language_">console</span>.<span class="title function_">log</span>(a); <span class="comment">//4</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">let</span> b = test.<span class="title function_">find</span>(<span class="function"><span class="params">item</span> =&gt;</span> item == <span class="number">0</span>);</span><br><span class="line"><span class="variable language_">console</span>.<span class="title function_">log</span>(b); <span class="comment">//undefined</span></span><br></pre></td></tr></table></figure>
<h1 id="javascript获取url参数"><a href="#javascript获取url参数" class="headerlink" title="javascript获取url参数"></a>javascript获取url参数</h1><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//http://abc.com:8080/dir/index.html?id=255</span></span><br><span class="line"><span class="keyword">const</span> parsedUrl = <span class="variable language_">window</span>.<span class="property">location</span>.<span class="property">href</span>.<span class="title function_">split</span>(<span class="string">&#x27;?&#x27;</span>).<span class="title function_">slice</span>(<span class="number">1</span>)</span><br><span class="line"><span class="keyword">const</span> allparser = &#123;&#125;</span><br><span class="line">parsedUrl.<span class="title function_">forEach</span>(<span class="function">(<span class="params">query</span>) =&gt;</span> &#123;</span><br><span class="line"><span class="comment">// console.log(&#x27;key&#x27;,query.split(&quot;=&quot;)[0],&#x27;value&#x27;,query.split(&quot;=&quot;)[1])</span></span><br><span class="line">    <span class="comment">//key = id</span></span><br><span class="line">    <span class="keyword">let</span> key = query.<span class="title function_">split</span>(<span class="string">&quot;=&quot;</span>)[<span class="number">0</span>]</span><br><span class="line">    <span class="comment">//value = 255</span></span><br><span class="line">    <span class="keyword">let</span> value = query.<span class="title function_">split</span>(<span class="string">&quot;=&quot;</span>)[<span class="number">1</span>]</span><br><span class="line">    allparser[key] = value</span><br><span class="line">&#125;)</span><br></pre></td></tr></table></figure>
<h1 id="uniapp进度条"><a href="#uniapp进度条" class="headerlink" title="uniapp进度条"></a><a target="_blank" rel="noopener" href="https://uniapp.dcloud.io/component/progress?id=progress">uniapp进度条</a></h1><figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">progress</span> <span class="attr">percent</span>=<span class="string">&quot;20&quot;</span> <span class="attr">show-info</span> <span class="attr">stroke-width</span>=<span class="string">&quot;3&quot;</span> /&gt;</span></span><br></pre></td></tr></table></figure>
<h1 id="JS如何判断一个数组是否为空、是否含有某个值"><a href="#JS如何判断一个数组是否为空、是否含有某个值" class="headerlink" title="JS如何判断一个数组是否为空、是否含有某个值"></a><a target="_blank" rel="noopener" href="https://www.cnblogs.com/crackedlove/p/10039939.html">JS如何判断一个数组是否为空、是否含有某个值</a></h1><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">let</span> arr = [];</span><br><span class="line"><span class="keyword">if</span> (arr.<span class="property">length</span> == <span class="number">0</span>)&#123;</span><br><span class="line">   <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="string">&quot;数组为空&quot;</span>)</span><br><span class="line">&#125;<span class="keyword">else</span> &#123;</span><br><span class="line">   <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="string">&quot;数组不为空&quot;</span>)</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h1 id="vue项目刷新当前页面的三种方法"><a href="#vue项目刷新当前页面的三种方法" class="headerlink" title="vue项目刷新当前页面的三种方法"></a><a target="_blank" rel="noopener" href="https://www.jb51.net/article/151984.htm">vue项目刷新当前页面的三种方法</a></h1><p>新建一个空白页面back.vue，点击确定的时候先跳转到这个空白页，然后再立马跳转回来</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="variable language_">this</span>.<span class="property">$router</span>.<span class="title function_">replace</span>(&#123;</span><br><span class="line">    <span class="attr">path</span>:<span class="string">&#x27;/back&#x27;</span>,</span><br><span class="line">    <span class="attr">name</span>:<span class="string">&#x27;back&#x27;</span></span><br><span class="line">&#125;)</span><br></pre></td></tr></table></figure>
<p>空白页back.vue里面的内容：</p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">template</span>&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="tag">&lt;/<span class="name">template</span>&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="tag">&lt;<span class="name">script</span>&gt;</span><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"><span class="keyword">export</span> <span class="keyword">default</span> &#123;</span></span><br><span class="line"><span class="language-javascript">  <span class="title function_">data</span>(<span class="params"></span>) &#123;</span></span><br><span class="line"><span class="language-javascript">      <span class="comment">//跳转回当前页面</span></span></span><br><span class="line"><span class="language-javascript">    <span class="variable language_">this</span>.<span class="property">$router</span>.<span class="title function_">replace</span>(&#123;</span></span><br><span class="line"><span class="language-javascript">		<span class="attr">path</span>:<span class="string">&#x27;/&#x27;</span>,</span></span><br><span class="line"><span class="language-javascript">		<span class="attr">name</span>:<span class="string">&#x27;home&#x27;</span></span></span><br><span class="line"><span class="language-javascript">	&#125;)</span></span><br><span class="line"><span class="language-javascript">	<span class="keyword">return</span>&#123;</span></span><br><span class="line"><span class="language-javascript">		</span></span><br><span class="line"><span class="language-javascript">	&#125;</span></span><br><span class="line"><span class="language-javascript">  &#125;,</span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript">  <span class="attr">methods</span>: &#123;</span></span><br><span class="line"><span class="language-javascript">   </span></span><br><span class="line"><span class="language-javascript">  &#125;</span></span><br><span class="line"><span class="language-javascript">&#125;</span></span><br><span class="line"><span class="language-javascript"></span><span class="tag">&lt;/<span class="name">script</span>&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="tag">&lt;<span class="name">style</span> <span class="attr">lang</span>=<span class="string">&quot;less&quot;</span> <span class="attr">scoped</span>&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="tag">&lt;/<span class="name">style</span>&gt;</span></span><br></pre></td></tr></table></figure>
<p>这个方式，相比第一种不会出现一瞬间的空白页，只是地址栏有个快速的切换的过程，可采用</p>
<h1 id="JS-字符串截取方法汇总（slice、substring、substr等）"><a href="#JS-字符串截取方法汇总（slice、substring、substr等）" class="headerlink" title="JS - 字符串截取方法汇总（slice、substring、substr等）"></a><a target="_blank" rel="noopener" href="https://www.hangge.com/blog/cache/detail_1887.html">JS - 字符串截取方法汇总（slice、substring、substr等）</a></h1><h3 id="1、使用-slice-截取"><a href="#1、使用-slice-截取" class="headerlink" title="1、使用 slice() 截取"></a>1、使用 slice() 截取</h3><h4 id="1，函数说明"><a href="#1，函数说明" class="headerlink" title="1，函数说明"></a>1，函数说明</h4><p><strong>slice()</strong> 方法可通过指定的开始和结束位置，提取字符串的某个部分，并以新的字符串返回被提取的部分。语法如下：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">stringObject.slice(start, end)</span><br></pre></td></tr></table></figure>
<p><strong>参数说明：</strong></p>
<ul>
<li><strong>start</strong>（必需）：规定从何处开始选取。如果是负数，那么它规定从字符串尾部开始算起的位置。也就是说，<strong>-1</strong> 指最后一个字符，<strong>-2</strong> 指倒数第二个字符，以此类推。</li>
<li><strong>end</strong>（可选）：规定从何处结束选取，即结束处的字符下标。如果没有指定该参数，那么截取的字符串包含从 <strong>start</strong> 到结束的所有字符。如果这个参数是负数，那么它规定的是从数组尾部开始算起的字符。</li>
</ul>
<h3 id="2，使用样例"><a href="#2，使用样例" class="headerlink" title="2，使用样例"></a>2，使用样例</h3><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">var</span> str = <span class="string">&quot;0123456789&quot;</span>;</span><br><span class="line"><span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="string">&quot;原始字符串：&quot;</span>, str);</span><br><span class="line"> </span><br><span class="line"><span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="string">&quot;从索引为3的字符起一直到结束：&quot;</span>, str.<span class="title function_">slice</span>(<span class="number">3</span>));  <span class="comment">//3456789</span></span><br><span class="line"><span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="string">&quot;从倒数第3个字符起一直到结束：&quot;</span>, str.<span class="title function_">slice</span>(-<span class="number">3</span>));  <span class="comment">//789</span></span><br><span class="line"> </span><br><span class="line"><span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="string">&quot;从开始一直到索引为5的前一个字符：&quot;</span>, str.<span class="title function_">slice</span>(<span class="number">0</span>,<span class="number">5</span>));  <span class="comment">//01234</span></span><br><span class="line"><span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="string">&quot;从开始一直到倒数第3个字符的前一个字符：&quot;</span>, str.<span class="title function_">slice</span>(<span class="number">0</span>,-<span class="number">3</span>));  <span class="comment">//0123456</span></span><br><span class="line"> </span><br><span class="line"><span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="string">&quot;从索引为3的字符起到索引为5的前一个字符：&quot;</span>, str.<span class="title function_">slice</span>(<span class="number">3</span>,<span class="number">5</span>));  <span class="comment">//34</span></span><br><span class="line"><span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="string">&quot;从索引为3的字符起到倒数第3个字符的前一个字符：&quot;</span>, str.<span class="title function_">slice</span>(<span class="number">3</span>,-<span class="number">3</span>));  <span class="comment">//3456</span></span><br></pre></td></tr></table></figure>
<h1 id="免费在线条形码生成器-条码生成制作工具"><a href="#免费在线条形码生成器-条码生成制作工具" class="headerlink" title="免费在线条形码生成器-条码生成制作工具"></a><a target="_blank" rel="noopener" href="http://barcode.cnaidc.com/html/BCGcode128b.php">免费在线条形码生成器-条码生成制作工具</a></h1><h1 id="js-时间戳转为日期格式"><a href="#js-时间戳转为日期格式" class="headerlink" title="js 时间戳转为日期格式"></a><a target="_blank" rel="noopener" href="https://www.cnblogs.com/jingwhale/p/4674946.html">js 时间戳转为日期格式</a></h1><p>首次加载的时候，需要将时间戳转换为规定时间样式，可使用工具类utli.js</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">function</span> <span class="title function_">add0</span>(<span class="params">m</span>)&#123;<span class="keyword">return</span> m&lt;<span class="number">10</span>?<span class="string">&#x27;0&#x27;</span>+<span class="attr">m</span>:m &#125;</span><br><span class="line"><span class="keyword">function</span> <span class="title function_">js_date_time</span>(<span class="params">unixtime,type</span>) &#123;</span><br><span class="line">  <span class="keyword">var</span> dateTime = <span class="keyword">new</span> <span class="title class_">Date</span>(<span class="built_in">parseInt</span>(unixtime) * <span class="number">1000</span>);</span><br><span class="line">  <span class="keyword">var</span> year = dateTime.<span class="title function_">getFullYear</span>();</span><br><span class="line">  <span class="keyword">var</span> month = dateTime.<span class="title function_">getMonth</span>() + <span class="number">1</span>;</span><br><span class="line">  <span class="keyword">var</span> day = dateTime.<span class="title function_">getDate</span>();</span><br><span class="line">  <span class="keyword">var</span> hour = dateTime.<span class="title function_">getHours</span>();</span><br><span class="line">  <span class="keyword">var</span> minute = dateTime.<span class="title function_">getMinutes</span>();</span><br><span class="line">  <span class="keyword">var</span> second = dateTime.<span class="title function_">getSeconds</span>();</span><br><span class="line">  <span class="keyword">var</span> now = <span class="keyword">new</span> <span class="title class_">Date</span>();</span><br><span class="line">  <span class="keyword">var</span> now_new = <span class="title class_">Date</span>.<span class="title function_">parse</span>(now.<span class="title function_">toDateString</span>()); <span class="comment">//typescript转换写法</span></span><br><span class="line">  <span class="keyword">var</span> milliseconds = now_new - dateTime;</span><br><span class="line">  <span class="keyword">if</span>(type)&#123;</span><br><span class="line">    <span class="keyword">var</span> timeSpanStr = year + <span class="string">&#x27;-&#x27;</span> + <span class="title function_">add0</span>(month) + <span class="string">&#x27;-&#x27;</span> + <span class="title function_">add0</span>(day) + <span class="string">&#x27; &#x27;</span> + <span class="title function_">add0</span>(hour) + <span class="string">&#x27;:&#x27;</span> + <span class="title function_">add0</span>(minute) + <span class="string">&#x27;:&#x27;</span> + <span class="title function_">add0</span>(second);</span><br><span class="line">    <span class="keyword">return</span> timeSpanStr;</span><br><span class="line">  &#125;<span class="keyword">else</span>&#123;</span><br><span class="line">    <span class="keyword">var</span> timeSpanStr = year + <span class="string">&#x27;-&#x27;</span> + <span class="title function_">add0</span>(month) + <span class="string">&#x27;-&#x27;</span> + <span class="title function_">add0</span>(day);</span><br><span class="line">    <span class="keyword">return</span> timeSpanStr;</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">&#125;</span><br><span class="line"><span class="variable language_">module</span>.<span class="property">exports</span> = &#123;</span><br><span class="line">  <span class="attr">js_date_time</span>: js_date_time</span><br><span class="line">&#125;;</span><br></pre></td></tr></table></figure>
<p>用法(引入即可调用方法使用):</p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">script</span>&gt;</span><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript">  <span class="keyword">var</span> util = <span class="built_in">require</span>(<span class="string">&#x27;../../utils/util.js&#x27;</span>);</span></span><br><span class="line"><span class="language-javascript">  <span class="variable language_">this</span>.<span class="property">pig</span>.<span class="property">add_time</span> = util.<span class="title function_">js_date_time</span>(result.<span class="property">add_time</span>);</span></span><br><span class="line"><span class="language-javascript"></span><span class="tag">&lt;/<span class="name">script</span>&gt;</span></span><br></pre></td></tr></table></figure>
<h1 id="vue-内联样式style中的background"><a href="#vue-内联样式style中的background" class="headerlink" title="vue 内联样式style中的background"></a><a target="_blank" rel="noopener" href="https://www.cnblogs.com/WoAiZmm/p/8227797.html">vue 内联样式style中的background</a></h1><p>注意 在vue中直接使用style时 花括号一定别忘记</p>
<p>还有就是你的url一定要加引号拼接</p>
<p>：style = ‘ { backgroundImage : “ url ( “ + item.img + “ ) “ } ‘ </p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">div</span> <span class="attr">:style</span>=<span class="string">&quot; &#x27;background-image&#x27; : &#x27; url( &#x27; + 内容+&#x27; ) &#x27; &quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br></pre></td></tr></table></figure>
<h1 id="土豆图床"><a href="#土豆图床" class="headerlink" title="土豆图床"></a><a target="_blank" rel="noopener" href="https://images.ac.cn/simple.html">土豆图床</a></h1><h1 id="uni-设置placeholder颜色"><a href="#uni-设置placeholder颜色" class="headerlink" title="uni 设置placeholder颜色"></a><a target="_blank" rel="noopener" href="https://blog.csdn.net/qq_43840143/article/details/103609962">uni 设置placeholder颜色</a></h1><figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="selector-pseudo">:placeholder</span>=&quot;nichengzhi&quot; placeholder-class=&quot;cl&quot;//给此属性上样式</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.cl</span>&#123;</span><br><span class="line">	<span class="attribute">color</span>: <span class="number">#BBBBBB</span>;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h1 id="uniapp监听webview值的变动（引入页面的title）"><a href="#uniapp监听webview值的变动（引入页面的title）" class="headerlink" title="uniapp监听webview值的变动（引入页面的title）"></a>uniapp监听webview值的变动（引入页面的title）</h1><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//动态修改标题</span></span><br><span class="line"><span class="variable language_">this</span>.<span class="property">pig_house_id</span> = <span class="variable language_">this</span>.<span class="property">$store</span>.<span class="property">state</span>.<span class="property">platform</span>.<span class="property">pig_house_id</span></span><br><span class="line">uni.<span class="title function_">setNavigationBarTitle</span>(&#123;</span><br><span class="line">	<span class="attr">title</span>:<span class="variable language_">this</span>.<span class="property">pig_house_id</span>+<span class="string">&#x27;号猪舍&#x27;</span></span><br><span class="line">&#125;)</span><br></pre></td></tr></table></figure>
<h1 id="uni-app-打开外链网址和打开内部网页的方法"><a href="#uni-app-打开外链网址和打开内部网页的方法" class="headerlink" title="uni-app 打开外链网址和打开内部网页的方法"></a><a target="_blank" rel="noopener" href="https://blog.csdn.net/haibo0668/article/details/86349504">uni-app 打开外链网址和打开内部网页的方法</a></h1><p>打开外链网址</p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">template</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">view</span>&gt;</span></span><br><span class="line">        <span class="tag">&lt;<span class="name">web-view</span> <span class="attr">src</span>=<span class="string">&quot;https://uniapp.dcloud.io/static/web-view.html&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">web-view</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;/<span class="name">view</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">template</span>&gt;</span></span><br><span class="line"></span><br></pre></td></tr></table></figure>
<h1 id="小程序-在手机上如果不打开调试模式-不能正常请求接口-打开调试模试就可以正常请求-真机测试和开发者工具都可以正常显示"><a href="#小程序-在手机上如果不打开调试模式-不能正常请求接口-打开调试模试就可以正常请求-真机测试和开发者工具都可以正常显示" class="headerlink" title="小程序:在手机上如果不打开调试模式,不能正常请求接口,打开调试模试就可以正常请求,真机测试和开发者工具都可以正常显示"></a><a target="_blank" rel="noopener" href="https://blog.csdn.net/czkcui123/article/details/87614410">小程序:在手机上如果不打开调试模式,不能正常请求接口,打开调试模试就可以正常请求,真机测试和开发者工具都可以正常显示</a></h1><p>因为真机测试和开发者工具都会配置      不检验合法域名、web-view（业务域名）、TLS 版本以及 HTTPS 证书</p>
<p><img src= "/web/img/loading.gif" data-lazy-src="/img/配置.png" alt="8"></p>
<p>所以如果想手机能打开的话，把你的域名写在request和uploadFile里,如果需要下载,也把downloadFile也加上,当然写这篇文章主要是为了解决不能上传的问题,</p>
<p>这样就解决问题啦</p>
<h1 id="JS中对象转数组方法总结"><a href="#JS中对象转数组方法总结" class="headerlink" title="JS中对象转数组方法总结"></a><a target="_blank" rel="noopener" href="https://www.cnblogs.com/JiAyInNnNn/p/11451000.html">JS中对象转数组方法总结</a></h1><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">let</span> obj = &#123;</span><br><span class="line">    <span class="number">0</span>: <span class="string">&#x27;nihao&#x27;</span>,</span><br><span class="line">    <span class="number">1</span>: <span class="string">&#x27;haha&#x27;</span>,</span><br><span class="line">    <span class="number">2</span>: <span class="string">&#x27;gansha&#x27;</span>,</span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">let</span> arr = <span class="title class_">Object</span>.<span class="title function_">values</span>(obj)</span><br><span class="line"><span class="variable language_">console</span>.<span class="title function_">log</span>(arr);<span class="comment">//[&quot;nihao&quot;,&quot;haha&quot;,&quot;gansha&quot;]</span></span><br></pre></td></tr></table></figure>
<h1 id="js-判断是否为空对象、空数组"><a href="#js-判断是否为空对象、空数组" class="headerlink" title="js 判断是否为空对象、空数组"></a><a target="_blank" rel="noopener" href="https://www.cnblogs.com/xxhuan/p/6582114.html">js 判断是否为空对象、空数组</a></h1><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// 检验 undefined 和 null</span></span><br><span class="line"><span class="keyword">if</span>(!obj &amp;&amp; obj !== <span class="number">0</span> &amp;&amp; obj !== <span class="string">&#x27;&#x27;</span>) &#123;&lt;br&gt;　　　　　　　　　　</span><br><span class="line">  <span class="keyword">return</span> <span class="literal">true</span>;</span><br><span class="line">&#125;</span><br><span class="line"><span class="title class_">JSON</span>.<span class="title function_">stringify</span>(obj) === <span class="string">&#x27;&#123;&#125;&#x27;</span>;</span><br><span class="line"><span class="title class_">JSON</span>.<span class="title function_">stringify</span>(obj) === <span class="string">&#x27;[]&#x27;</span></span><br></pre></td></tr></table></figure>
<h1 id="微信小程序引用页面调用组件内的方法（父组件调用子组件的方法）"><a href="#微信小程序引用页面调用组件内的方法（父组件调用子组件的方法）" class="headerlink" title="微信小程序引用页面调用组件内的方法（父组件调用子组件的方法）"></a><a target="_blank" rel="noopener" href="https://blog.csdn.net/Syleapn/article/details/94591977">微信小程序引用页面调用组件内的方法（父组件调用子组件的方法）</a></h1><p><img src= "/web/img/loading.gif" data-lazy-src="/img/fuzhujian.png" alt="5"></p>
<p><img src= "/web/img/loading.gif" data-lazy-src="/img/fangfa.png" alt="6"></p>
<p><img src= "/web/img/loading.gif" data-lazy-src="/img/zizj.png" alt="7"></p>
<h1 id="浅谈前端常见的数组和对象的遍历问题"><a href="#浅谈前端常见的数组和对象的遍历问题" class="headerlink" title="浅谈前端常见的数组和对象的遍历问题"></a><a target="_blank" rel="noopener" href="https://blog.csdn.net/mapbar_front/article/details/81046819">浅谈前端常见的数组和对象的遍历问题</a></h1><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">var</span> arr = [<span class="number">1</span>,<span class="number">2</span>,<span class="number">3</span>];</span><br><span class="line"><span class="keyword">for</span>(<span class="keyword">var</span> i = <span class="number">0</span>; i &lt; arr.<span class="property">length</span>; i++)&#123;</span><br><span class="line">    <span class="variable language_">console</span>.<span class="title function_">log</span>(arr[i]);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h1 id="CSS文本溢出显示省略号"><a href="#CSS文本溢出显示省略号" class="headerlink" title="CSS文本溢出显示省略号"></a><a target="_blank" rel="noopener" href="https://www.cnblogs.com/best-coder/p/11550185.html"><a target="_blank" rel="noopener" href="https://www.cnblogs.com/best-coder/p/11550185.html">CSS文本溢出显示省略号</a></a></h1><ul>
<li>-webkit-line-clamp 用来限制在一个块元素显示的文本的行数,这是一个不规范的属性（unsupported WebKit property），它没有出现在 CSS 规范草案中。</li>
<li>display: -webkit-box 将对象作为弹性伸缩盒子模型显示 。</li>
<li>-webkit-box-orient 设置或检索伸缩盒对象的子元素的排列方式 。</li>
<li>text-overflow: ellipsis 以用来多行文本的情况下，用省略号“…”隐藏超出范围的文本。</li>
</ul>
<figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="attribute">overflow</span>: hidden;</span><br><span class="line"><span class="attribute">text-overflow</span>: ellipsis;</span><br><span class="line"><span class="attribute">white-space</span>:nowrap;</span><br><span class="line"><span class="attribute">display</span>: -webkit-box;</span><br><span class="line">-webkit-line-clamp: <span class="number">2</span>;</span><br><span class="line">-webkit-box-orient: vertical;</span><br></pre></td></tr></table></figure>
<h1 id="微信小程序分享功能"><a href="#微信小程序分享功能" class="headerlink" title="微信小程序分享功能"></a>微信小程序分享功能</h1><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"><span class="title function_">onLoad</span>(<span class="params"></span>) &#123;</span><br><span class="line">  <span class="variable language_">this</span>.<span class="title function_">getCouponConfBg</span>();</span><br><span class="line">  <span class="variable language_">this</span>.<span class="title function_">getUserId</span>();</span><br><span class="line">  <span class="comment">// let old_user_id = wx.getStorageSync(&#x27;user_id&#x27;);</span></span><br><span class="line">  <span class="comment">// this.setData(&#123; old_user_id: old_user_id &#125;);</span></span><br><span class="line">&#125;,</span><br><span class="line"></span><br><span class="line"><span class="title function_">onShow</span>(<span class="params"></span>) &#123;&#125;,</span><br><span class="line"></span><br><span class="line"><span class="title function_">onReachBottom</span>(<span class="params"></span>) &#123;&#125;,</span><br><span class="line"><span class="comment">//微信小程序分享转发功能</span></span><br><span class="line"><span class="attr">onShareAppMessage</span>: <span class="keyword">function</span> (<span class="params">res</span>) &#123;</span><br><span class="line">  <span class="keyword">if</span> (res.<span class="property">from</span> === <span class="string">&#x27;button&#x27;</span>) &#123;</span><br><span class="line">    <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="string">&#x27;this.data.shareurl&#x27;</span>, <span class="variable language_">this</span>.<span class="property">data</span>.<span class="property">old_user_id</span>);</span><br><span class="line">    <span class="variable language_">this</span>.<span class="title function_">hidepickbox</span>();</span><br><span class="line">  &#125;</span><br><span class="line">  <span class="keyword">return</span> &#123;</span><br><span class="line">    <span class="comment">//修改标题</span></span><br><span class="line">    <span class="attr">title</span>: <span class="string">&#x27;凯螺工友惠开启啦！快来领取最高500元大红包！！&#x27;</span>,</span><br><span class="line">    <span class="comment">//编写入口和参数</span></span><br><span class="line">    <span class="attr">path</span>: <span class="string">&#x27;/pages/index/index?old_user_id=&#x27;</span> + <span class="variable language_">this</span>.<span class="property">data</span>.<span class="property">old_user_id</span>,</span><br><span class="line">    <span class="comment">// 自定义分享图片，不写默认为当前页面截图</span></span><br><span class="line">    <span class="comment">// imageUrl:&#x27;https://ae01.alicdn.com/kf/H8e5cfc3b44d147c8a7b3eadec5560da3i.jpg&#x27;,</span></span><br><span class="line">    <span class="attr">success</span>: <span class="keyword">function</span> (<span class="params">res</span>) &#123;</span><br><span class="line">      <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="string">&#x27;成功&#x27;</span>, res);</span><br><span class="line">    &#125;</span><br><span class="line">  &#125;;</span><br><span class="line">&#125;,</span><br></pre></td></tr></table></figure>
<h1 id="微信小程序分享二维码背景图，并自动保存下载下来"><a href="#微信小程序分享二维码背景图，并自动保存下载下来" class="headerlink" title="微信小程序分享二维码背景图，并自动保存下载下来"></a>微信小程序分享二维码背景图，并自动保存下载下来</h1><figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">view</span> <span class="attr">class</span>=<span class="string">&quot;index&quot;</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">canvas</span> <span class="attr">canvas-id</span>=<span class="string">&quot;shareCanvas&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">wx:if</span>=<span class="string">&quot;&#123;&#123;showdown&#125;&#125;&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">style</span>=<span class="string">&#x27;width:&#123;&#123;windowW&#125;&#125;px;height:&#123;&#123;windowH&#125;&#125;px&#x27;</span>&gt;</span><span class="tag">&lt;/<span class="name">canvas</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">view</span>&gt;</span></span><br></pre></td></tr></table></figure>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> &#123; base64src &#125; <span class="keyword">from</span> <span class="string">&#x27;./b64.js&#x27;</span>;</span><br><span class="line"><span class="keyword">import</span> <span class="variable constant_">API</span> <span class="keyword">from</span> <span class="string">&#x27;../../api/api&#x27;</span>;</span><br><span class="line"><span class="title class_">Page</span>(&#123;</span><br><span class="line">  <span class="attr">data</span>: &#123;</span><br><span class="line">    <span class="attr">tempFilePath</span>:</span><br><span class="line">      <span class="string">&#x27;https://ae01.alicdn.com/kf/Hc004de7ec3744190812bbd5a28367104r.jpg&#x27;</span>,</span><br><span class="line">    <span class="attr">windowW</span>: <span class="string">&#x27;&#x27;</span>,</span><br><span class="line">    <span class="attr">windowH</span>: <span class="string">&#x27;&#x27;</span>,</span><br><span class="line">    <span class="attr">shareewmurl</span>: <span class="string">&#x27;&#x27;</span>,</span><br><span class="line">    <span class="attr">moment_bg</span>: <span class="string">&#x27;&#x27;</span>,</span><br><span class="line">    <span class="attr">showdown</span>: <span class="literal">true</span></span><br><span class="line">  &#125;,</span><br><span class="line"></span><br><span class="line">  <span class="attr">onReady</span>: <span class="keyword">function</span> (<span class="params"></span>) &#123;&#125;,</span><br><span class="line">  <span class="title function_">onLoad</span>(<span class="params"></span>) &#123;</span><br><span class="line">    <span class="variable language_">this</span>.<span class="title function_">getCouponConfBg</span>();</span><br><span class="line">    <span class="variable language_">this</span>.<span class="title function_">getUserId</span>();</span><br><span class="line">    <span class="keyword">let</span> that = <span class="variable language_">this</span>;</span><br><span class="line">    <span class="comment">//获取设备的宽高，全屏描画</span></span><br><span class="line">    wx.<span class="title function_">getSystemInfo</span>(&#123;</span><br><span class="line">      <span class="attr">success</span>: <span class="keyword">function</span> (<span class="params">res</span>) &#123;</span><br><span class="line">        that.<span class="title function_">setData</span>(&#123;</span><br><span class="line">          <span class="attr">windowW</span>: res.<span class="property">windowWidth</span>,</span><br><span class="line">          <span class="attr">windowH</span>: res.<span class="property">windowHeight</span></span><br><span class="line">        &#125;);</span><br><span class="line">      &#125;</span><br><span class="line">    &#125;);</span><br><span class="line">  &#125;,</span><br><span class="line">  <span class="comment">// 获取用户ID</span></span><br><span class="line">  <span class="keyword">async</span> <span class="title function_">getUserId</span>(<span class="params"></span>) &#123;</span><br><span class="line">    <span class="keyword">const</span> res = <span class="keyword">await</span> <span class="variable constant_">API</span>.<span class="title function_">couponFissionGetShareWxQRCode</span>();</span><br><span class="line">    <span class="variable language_">this</span>.<span class="title function_">setData</span>(&#123; <span class="attr">shareewmurl</span>: <span class="string">&#x27;data:image/png;base64,&#x27;</span> + res &#125;);</span><br><span class="line">    <span class="variable language_">this</span>.<span class="title function_">showimg</span>();</span><br><span class="line">  &#125;,</span><br><span class="line">  <span class="comment">// 获取优惠券活动背景图</span></span><br><span class="line">  <span class="keyword">async</span> <span class="title function_">getCouponConfBg</span>(<span class="params"></span>) &#123;</span><br><span class="line">    <span class="keyword">const</span> res = <span class="keyword">await</span> <span class="variable constant_">API</span>.<span class="title function_">getCouponConfBg</span>();</span><br><span class="line">    <span class="variable language_">this</span>.<span class="title function_">setData</span>(&#123; <span class="attr">moment_bg</span>: res.<span class="property">moment_bg</span> &#125;);</span><br><span class="line">    <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="variable language_">this</span>.<span class="property">data</span>.<span class="property">moment_bg</span>, <span class="string">&#x27;res&#x27;</span>);</span><br><span class="line">  &#125;,</span><br><span class="line">  <span class="title function_">showimg</span>(<span class="params"></span>) &#123;</span><br><span class="line">    <span class="comment">// 根据id创建画布</span></span><br><span class="line">    <span class="keyword">const</span> ctx = wx.<span class="title function_">createCanvasContext</span>(<span class="string">&#x27;shareCanvas&#x27;</span>, <span class="variable language_">this</span>);</span><br><span class="line">    <span class="keyword">const</span> self = <span class="variable language_">this</span>;</span><br><span class="line">    <span class="keyword">var</span> rpxw = self.<span class="property">data</span>.<span class="property">windowW</span>;</span><br><span class="line">    <span class="keyword">var</span> rpxh = self.<span class="property">data</span>.<span class="property">windowH</span>;</span><br><span class="line">    <span class="comment">// 分两步走，第一步wx.downloadFile下载</span></span><br><span class="line">    wx.<span class="title function_">downloadFile</span>(&#123;</span><br><span class="line">      <span class="attr">url</span>: self.<span class="property">data</span>.<span class="property">moment_bg</span>, <span class="comment">//仅为示例，并非真实的资源</span></span><br><span class="line">      <span class="title function_">success</span>(<span class="params">res1</span>) &#123;</span><br><span class="line">        <span class="keyword">let</span> path = res1.<span class="property">tempFilePath</span>;</span><br><span class="line">        <span class="comment">// base64转成img</span></span><br><span class="line">        <span class="title function_">base64src</span>(self.<span class="property">data</span>.<span class="property">shareewmurl</span>, <span class="function"><span class="params">res</span> =&gt;</span> &#123;</span><br><span class="line">          <span class="variable language_">console</span>.<span class="title function_">log</span>(res);</span><br><span class="line">          <span class="comment">// 画下好的图片路径，开始x，y轴参数，画多宽，多高</span></span><br><span class="line">          ctx.<span class="title function_">drawImage</span>(path, <span class="number">0</span>, <span class="number">0</span>, rpxw, rpxh);</span><br><span class="line">          ctx.<span class="title function_">drawImage</span>(res, <span class="number">0.4</span> * rpxw, <span class="number">0.69</span> * rpxh, <span class="number">0.18</span> * rpxw, <span class="number">0.18</span> * rpxw);</span><br><span class="line">          ctx.<span class="title function_">draw</span>(</span><br><span class="line">            <span class="literal">false</span>,</span><br><span class="line">            <span class="built_in">setTimeout</span>(<span class="function">() =&gt;</span> &#123;</span><br><span class="line">              <span class="comment">// 开始画画</span></span><br><span class="line">              wx.<span class="title function_">canvasToTempFilePath</span>(&#123;</span><br><span class="line">                <span class="attr">x</span>: <span class="number">0</span>,</span><br><span class="line">                <span class="attr">y</span>: <span class="number">0</span>,</span><br><span class="line">                <span class="attr">canvasId</span>: <span class="string">&#x27;shareCanvas&#x27;</span>,</span><br><span class="line">                <span class="attr">success</span>: <span class="function"><span class="params">res</span> =&gt;</span> &#123;</span><br><span class="line">                  <span class="comment">// 下载画好的图片</span></span><br><span class="line">                  wx.<span class="title function_">saveImageToPhotosAlbum</span>(&#123;</span><br><span class="line">                    <span class="attr">filePath</span>: res.<span class="property">tempFilePath</span>,</span><br><span class="line">                    <span class="attr">success</span>: <span class="function">() =&gt;</span> &#123;</span><br><span class="line">                      wx.<span class="title function_">showToast</span>(&#123;</span><br><span class="line">                        <span class="attr">title</span>: <span class="string">&#x27;保存成功&#x27;</span>,</span><br><span class="line"></span><br><span class="line">                        <span class="attr">icon</span>: <span class="string">&#x27;success&#x27;</span>,</span><br><span class="line"></span><br><span class="line">                        <span class="attr">duration</span>: <span class="number">2000</span> <span class="comment">//持续的时间</span></span><br><span class="line">                      &#125;);</span><br><span class="line"></span><br><span class="line">                      <span class="built_in">setTimeout</span>(<span class="function">() =&gt;</span> &#123;</span><br><span class="line">                        wx.<span class="title function_">switchTab</span>(&#123;</span><br><span class="line">                          <span class="attr">url</span>: <span class="string">`/pages/share/index`</span></span><br><span class="line">                        &#125;);</span><br><span class="line">                      &#125;, <span class="number">500</span>);</span><br><span class="line">                    &#125;,</span><br><span class="line">                    <span class="attr">fail</span>: <span class="function"><span class="params">err</span> =&gt;</span> &#123;</span><br><span class="line">                      wx.<span class="title function_">getSetting</span>(&#123;</span><br><span class="line">                        <span class="attr">success</span>: <span class="function"><span class="params">res</span> =&gt;</span> &#123;</span><br><span class="line">                          <span class="keyword">if</span> (</span><br><span class="line">                            !res.<span class="property">authSetting</span> ||</span><br><span class="line">                            !res.<span class="property">authSetting</span>[<span class="string">&#x27;scrop.writePhotoAlbum&#x27;</span>]</span><br><span class="line">                          ) &#123;</span><br><span class="line">                            wx.<span class="title function_">openSetting</span>();</span><br><span class="line">                          &#125;</span><br><span class="line">                        &#125;</span><br><span class="line">                      &#125;);</span><br><span class="line">                    &#125;</span><br><span class="line">                  &#125;);</span><br><span class="line">                &#125;</span><br><span class="line">              &#125;);</span><br><span class="line">            &#125;, <span class="number">1000</span>)</span><br><span class="line">          );</span><br><span class="line">        &#125;);</span><br><span class="line">      &#125;</span><br><span class="line">    &#125;);</span><br><span class="line">  &#125;</span><br><span class="line">&#125;);</span><br><span class="line"></span><br></pre></td></tr></table></figure>
<p>b64.js是将base64的文件</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">const</span> <span class="variable constant_">FILE_BASE_NAME</span> = <span class="string">&#x27;tmp_base64src&#x27;</span>; <span class="comment">//自定义文件名</span></span><br><span class="line"><span class="keyword">const</span> fsm = wx.<span class="title function_">getFileSystemManager</span>();</span><br><span class="line"><span class="keyword">function</span> <span class="title function_">base64src</span>(<span class="params">base64data, cb</span>) &#123;</span><br><span class="line">  <span class="keyword">const</span> [, format, bodyData] = <span class="regexp">/data:image\/(\w+);base64,(.*)/</span>.<span class="title function_">exec</span>(base64data) || [];</span><br><span class="line">  <span class="keyword">if</span> (!format) &#123;</span><br><span class="line">    <span class="keyword">return</span> (<span class="keyword">new</span> <span class="title class_">Error</span>(<span class="string">&#x27;ERROR_BASE64SRC_PARSE&#x27;</span>));</span><br><span class="line">  &#125;</span><br><span class="line">  <span class="keyword">const</span> filePath = <span class="string">`<span class="subst">$&#123;wx.env.USER_DATA_PATH&#125;</span>/<span class="subst">$&#123;FILE_BASE_NAME&#125;</span>.<span class="subst">$&#123;format&#125;</span>`</span>;</span><br><span class="line">  <span class="keyword">const</span> buffer = wx.<span class="title function_">base64ToArrayBuffer</span>(bodyData);</span><br><span class="line">  fsm.<span class="title function_">writeFile</span>(&#123;</span><br><span class="line">    filePath,</span><br><span class="line">    <span class="attr">data</span>: buffer,</span><br><span class="line">    <span class="attr">encoding</span>: <span class="string">&#x27;binary&#x27;</span>,</span><br><span class="line">    <span class="title function_">success</span>(<span class="params"></span>) &#123;</span><br><span class="line">      <span class="title function_">cb</span>(filePath);</span><br><span class="line">    &#125;,</span><br><span class="line">    <span class="title function_">fail</span>(<span class="params"></span>) &#123;</span><br><span class="line">      <span class="keyword">return</span> (<span class="keyword">new</span> <span class="title class_">Error</span>(<span class="string">&#x27;ERROR_BASE64SRC_WRITE&#x27;</span>));</span><br><span class="line">    &#125;,</span><br><span class="line">  &#125;);</span><br><span class="line">&#125;;</span><br><span class="line"></span><br><span class="line"><span class="keyword">export</span> &#123; base64src &#125;;</span><br></pre></td></tr></table></figure>
<h1 id="uni-app-中保持用户登录状态"><a href="#uni-app-中保持用户登录状态" class="headerlink" title="uni-app 中保持用户登录状态"></a>uni-app 中保持用户登录状态</h1><p>登录成功时，调用uni.setStorage</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">async</span> <span class="title function_">gotoaddress</span>(<span class="params"></span>) &#123;</span><br><span class="line">        <span class="keyword">const</span> params = <span class="variable language_">this</span>.<span class="title function_">checkForm</span>()</span><br><span class="line">        <span class="keyword">if</span> (!params) <span class="keyword">return</span> <span class="literal">false</span></span><br><span class="line">        <span class="variable language_">this</span>.<span class="property">$global</span>.<span class="title function_">showLoading</span>(&#123; <span class="attr">title</span>: <span class="string">&#x27;登录中&#x27;</span>, <span class="attr">mask</span>: <span class="literal">true</span> &#125;)</span><br><span class="line">        <span class="keyword">try</span> &#123;</span><br><span class="line">          <span class="variable language_">this</span>.<span class="property">news</span> = <span class="keyword">await</span> <span class="variable language_">this</span>.<span class="property">$API</span>.<span class="property">user</span>.<span class="title function_">loginChkLogin</span>(params)</span><br><span class="line">          uni.<span class="title function_">setStorage</span>(&#123;<span class="comment">//将用户信息保存在本地</span></span><br><span class="line">              <span class="attr">key</span>: <span class="string">&#x27;uerInfo&#x27;</span>,</span><br><span class="line">              <span class="attr">data</span>: <span class="literal">true</span></span><br><span class="line">          &#125;)</span><br><span class="line">          <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="variable language_">this</span>.<span class="property">news</span>)</span><br><span class="line">          uni.<span class="title function_">switchTab</span>(&#123;</span><br><span class="line">          	<span class="attr">url</span>: <span class="string">&#x27;./user/tab_bar/main&#x27;</span></span><br><span class="line">          &#125;)</span><br><span class="line">        &#125; <span class="keyword">finally</span> &#123;</span><br><span class="line">          <span class="variable language_">this</span>.<span class="property">$global</span>.<span class="title function_">hideLoading</span>()</span><br><span class="line">        &#125;</span><br><span class="line">        uni.<span class="title function_">showToast</span>(&#123;</span><br><span class="line">           <span class="attr">title</span>: <span class="string">&#x27;登录成功&#x27;</span>,</span><br><span class="line">           <span class="attr">icon</span>: <span class="string">&#x27;none&#x27;</span>,</span><br><span class="line">           <span class="attr">duration</span>: <span class="number">2000</span></span><br><span class="line">        &#125;)</span><br><span class="line">      &#125;,</span><br></pre></td></tr></table></figure>
<p>back.vue</p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">template</span>&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="tag">&lt;/<span class="name">template</span>&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="tag">&lt;<span class="name">script</span>&gt;</span><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"><span class="keyword">export</span> <span class="keyword">default</span> &#123;</span></span><br><span class="line"><span class="language-javascript">  <span class="title function_">data</span>(<span class="params"></span>) &#123;</span></span><br><span class="line"><span class="language-javascript">    <span class="keyword">return</span>&#123;</span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript">    &#125;</span></span><br><span class="line"><span class="language-javascript">  &#125;,</span></span><br><span class="line"><span class="language-javascript">  <span class="attr">onLoad</span>: <span class="keyword">function</span>(<span class="params"></span>) &#123;</span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript">  &#125;,</span></span><br><span class="line"><span class="language-javascript">  <span class="title function_">onShow</span>(<span class="params"></span>) &#123;</span></span><br><span class="line"><span class="language-javascript">    uni.<span class="title function_">getStorage</span>(&#123;<span class="comment">//获得保存在本地的用户信息</span></span></span><br><span class="line"><span class="language-javascript">        <span class="attr">key</span>: <span class="string">&#x27;uerInfo&#x27;</span>,</span></span><br><span class="line"><span class="language-javascript">        <span class="attr">success</span>:<span class="function">(<span class="params">res</span>) =&gt;</span> &#123;</span></span><br><span class="line"><span class="language-javascript">          <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="string">&#x27;uerInfo&#x27;</span>,res.<span class="property">data</span>)</span></span><br><span class="line"><span class="language-javascript">           <span class="keyword">if</span>(res.<span class="property">data</span>)&#123;</span></span><br><span class="line"><span class="language-javascript">             uni.<span class="title function_">switchTab</span>(&#123;</span></span><br><span class="line"><span class="language-javascript">             	<span class="attr">url</span>: <span class="string">&#x27;./user/tab_bar/main&#x27;</span></span></span><br><span class="line"><span class="language-javascript">             &#125;)</span></span><br><span class="line"><span class="language-javascript">           &#125;<span class="keyword">else</span>&#123;</span></span><br><span class="line"><span class="language-javascript">             uni.<span class="title function_">navigateTo</span>(&#123;</span></span><br><span class="line"><span class="language-javascript">             	<span class="attr">url</span>: <span class="string">&#x27;./platform/tab_bar/main&#x27;</span></span></span><br><span class="line"><span class="language-javascript">             &#125;)</span></span><br><span class="line"><span class="language-javascript">           &#125;</span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript">        &#125;,<span class="attr">fail</span>:<span class="function">(<span class="params">res</span>) =&gt;</span> &#123;</span></span><br><span class="line"><span class="language-javascript">          <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="string">&#x27;uerInfo&#x27;</span>,res)</span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript">            uni.<span class="title function_">navigateTo</span>(&#123;</span></span><br><span class="line"><span class="language-javascript">            	<span class="attr">url</span>: <span class="string">&#x27;./login&#x27;</span></span></span><br><span class="line"><span class="language-javascript">            &#125;)</span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript">        &#125;</span></span><br><span class="line"><span class="language-javascript">    &#125;);</span></span><br><span class="line"><span class="language-javascript">  &#125;,</span></span><br><span class="line"><span class="language-javascript">  <span class="attr">methods</span>: &#123;</span></span><br><span class="line"><span class="language-javascript"></span></span><br><span class="line"><span class="language-javascript">  &#125;</span></span><br><span class="line"><span class="language-javascript">&#125;</span></span><br><span class="line"><span class="language-javascript"></span><span class="tag">&lt;/<span class="name">script</span>&gt;</span></span><br><span class="line"></span><br></pre></td></tr></table></figure>
<h1 id="uniapp标题不想要返回按钮-lt"><a href="#uniapp标题不想要返回按钮-lt" class="headerlink" title="uniapp标题不想要返回按钮 &lt;"></a>uniapp标题不想要返回按钮 &lt;</h1><p>物理隐藏</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">&#123;</span><br><span class="line">      <span class="string">&quot;path&quot;</span>: <span class="string">&quot;pages/platform/tab_bar/main&quot;</span>,</span><br><span class="line">      <span class="string">&quot;style&quot;</span>: &#123;</span><br><span class="line">        <span class="string">&quot;navigationBarTitleText&quot;</span>: <span class="string">&quot;首页&quot;</span>,</span><br><span class="line">        <span class="string">&quot;app-plus&quot;</span>:&#123;          <span class="comment">//App端扩展配置</span></span><br><span class="line">                 <span class="string">&quot;titleNView&quot;</span>:&#123;<span class="comment">//原生导航栏配置参数</span></span><br><span class="line">                     <span class="string">&quot;backButton&quot;</span>:&#123;</span><br><span class="line">                       <span class="string">&quot;color&quot;</span>:<span class="string">&quot;#FFFFFF&quot;</span>,</span><br><span class="line">                       <span class="string">&quot;colorPressed&quot;</span>:<span class="string">&quot;#FFFFFF&quot;</span></span><br><span class="line">                     &#125;</span><br><span class="line">                   &#125;</span><br><span class="line">         &#125;</span><br><span class="line">      &#125;</span><br><span class="line">&#125;,</span><br></pre></td></tr></table></figure>
<p>功能清除</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="title function_">onBackPress</span>(<span class="params"></span>) &#123;</span><br><span class="line">      <span class="keyword">return</span> <span class="literal">true</span>;</span><br><span class="line">&#125;,</span><br></pre></td></tr></table></figure>
<h1 id="扫码登记"><a href="#扫码登记" class="headerlink" title="扫码登记"></a>扫码登记</h1><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// 允许从相机和相册扫码</span></span><br><span class="line">   <span class="title function_">scanCode</span>(<span class="params"></span>)&#123;</span><br><span class="line">       <span class="comment">// #ifndef H5</span></span><br><span class="line">       <span class="keyword">let</span> that = <span class="variable language_">this</span></span><br><span class="line">       uni.<span class="title function_">scanCode</span>(&#123;</span><br><span class="line">           <span class="attr">success</span>:<span class="keyword">function</span>(<span class="params">res1</span>)&#123;</span><br><span class="line">               <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="string">&#x27;条码类型：&#x27;</span> + res1.<span class="property">scanType</span> + <span class="string">&quot;&quot;</span>);</span><br><span class="line">               <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="string">&#x27;条码内容：&#x27;</span> + res1.<span class="property">result</span> + <span class="string">&quot;&quot;</span>);</span><br><span class="line">               <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="string">&#x27;条码字符集：&#x27;</span> + res1.<span class="property">charSet</span> + <span class="string">&quot;&quot;</span>);</span><br><span class="line">               uni.<span class="title function_">showModal</span>(&#123;</span><br><span class="line">                   <span class="attr">title</span>: <span class="string">&#x27;条码类型：&#x27;</span> + res1.<span class="property">scanType</span> + <span class="string">&quot;&quot;</span>,</span><br><span class="line">                   <span class="attr">content</span>: <span class="string">&#x27;条码内容：&#x27;</span> + res1.<span class="property">result</span> + <span class="string">&quot;&quot;</span>,</span><br><span class="line">                   <span class="attr">success</span>: <span class="keyword">function</span> (<span class="params">res</span>) &#123;</span><br><span class="line">                       <span class="keyword">if</span> (res.<span class="property">confirm</span>) &#123;</span><br><span class="line">                         that.<span class="property">user</span>.<span class="property">pk_no</span> = res1.<span class="property">result</span></span><br><span class="line">                           <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="string">&#x27;用户点击确定&#x27;</span>);</span><br><span class="line">                       &#125; <span class="keyword">else</span> <span class="keyword">if</span> (res.<span class="property">cancel</span>) &#123;</span><br><span class="line">                           <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="string">&#x27;用户点击取消&#x27;</span>);</span><br><span class="line">                       &#125;</span><br><span class="line">                   &#125;</span><br><span class="line">               &#125;)</span><br><span class="line">           &#125;,</span><br><span class="line">           <span class="attr">fail</span>:<span class="keyword">function</span>(<span class="params">e</span>)&#123;</span><br><span class="line">               <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="string">&#x27;扫描fail：&#x27;</span> + <span class="title class_">JSON</span>.<span class="title function_">stringify</span>(e));</span><br><span class="line">           &#125;,</span><br><span class="line">           <span class="attr">complete</span>:<span class="keyword">function</span>(<span class="params"></span>)&#123;</span><br><span class="line">               <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="string">&#x27;扫描complete&#x27;</span>);</span><br><span class="line">           &#125;</span><br><span class="line">       &#125;)</span><br><span class="line">       <span class="comment">// #endif</span></span><br><span class="line">   &#125;,</span><br></pre></td></tr></table></figure>
<h1 id="获取当前年月日"><a href="#获取当前年月日" class="headerlink" title="获取当前年月日"></a>获取当前年月日</h1><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"><span class="title function_">data</span>(<span class="params"></span>) &#123;</span><br><span class="line">	<span class="keyword">return</span> &#123;</span><br><span class="line">        <span class="attr">nowday</span>:<span class="string">&#x27;loading&#x27;</span>,</span><br><span class="line">    &#125;;</span><br><span class="line">&#125;,</span><br><span class="line"><span class="attr">onLoad</span>: <span class="keyword">function</span>(<span class="params"></span>) &#123;</span><br><span class="line">    <span class="keyword">var</span> myDate = <span class="keyword">new</span> <span class="title class_">Date</span>();</span><br><span class="line">    <span class="variable language_">this</span>.<span class="property">nowday</span> = myDate.<span class="title function_">getFullYear</span>() + <span class="string">&#x27;-&#x27;</span> + (myDate.<span class="title function_">getMonth</span>() + <span class="number">1</span>) + <span class="string">&#x27;-&#x27;</span> + myDate.<span class="title function_">getDate</span>();</span><br><span class="line">    <span class="comment">// 获取当前时间戳</span></span><br><span class="line">    <span class="comment">// new Date() new一个data对象，当前日期和时间</span></span><br><span class="line">    <span class="comment">// toLocaleString() 方法可根据本地时间把 Date 对象转换为字符串，并返回结果。</span></span><br><span class="line">    <span class="variable language_">this</span>.<span class="property">nowtime</span> = <span class="built_in">parseInt</span>(<span class="keyword">new</span> <span class="title class_">Date</span>().<span class="title function_">getTime</span>()/<span class="number">1000</span>)</span><br><span class="line">&#125;,</span><br><span class="line"></span><br></pre></td></tr></table></figure>
<h1 id="uniapp当前进层级太深时，拦截监听，重定向"><a href="#uniapp当前进层级太深时，拦截监听，重定向" class="headerlink" title="uniapp当前进层级太深时，拦截监听，重定向"></a>uniapp当前进层级太深时，拦截监听，重定向</h1><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="title function_">onBackPress</span>(<span class="params"></span>) &#123;</span><br><span class="line">    uni.<span class="title function_">switchTab</span>(&#123;</span><br><span class="line">        <span class="attr">url</span>: <span class="string">&#x27;./tab_bar/mine&#x27;</span></span><br><span class="line">    &#125;);</span><br><span class="line">    <span class="keyword">return</span> <span class="literal">false</span>;</span><br><span class="line">&#125;,</span><br></pre></td></tr></table></figure>
<h1 id="uniapp下拉选择"><a href="#uniapp下拉选择" class="headerlink" title="uniapp下拉选择"></a>uniapp下拉选择</h1><p>普通输入框必须禁止输入，添加disabled 属性</p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">&quot;inputbox flcm pickbox&quot;</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">&quot;label fsize28l&quot;</span>&gt;</span>品种：<span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">picker</span> @<span class="attr">change</span>=<span class="string">&quot;bindPickerTypeChange&quot;</span> <span class="attr">:range</span>=<span class="string">&quot;typearray&quot;</span>&gt;</span></span><br><span class="line">        <span class="tag">&lt;<span class="name">input</span> <span class="attr">type</span>=<span class="string">&quot;text&quot;</span> <span class="attr">placeholder</span>=<span class="string">&quot;输选择&quot;</span> <span class="attr">v-model</span>=<span class="string">&quot;result.type_name&quot;</span> <span class="attr">disabled</span> <span class="attr">class</span>=<span class="string">&quot;standard smallinput&quot;</span>/&gt;</span></span><br><span class="line">        <span class="tag">&lt;<span class="name">image</span> <span class="attr">src</span>=<span class="string">&quot;../../static/images/platform/down.png&quot;</span> <span class="attr">class</span>=<span class="string">&quot;img32 pickdownbtn&quot;</span> <span class="attr">mode</span>=<span class="string">&quot;&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">image</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;/<span class="name">picker</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br></pre></td></tr></table></figure>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="title function_">data</span>(<span class="params"></span>) &#123;</span><br><span class="line">    <span class="keyword">return</span> &#123;</span><br><span class="line">    	<span class="attr">typearray</span>:[<span class="string">&#x27;大白猪&#x27;</span>,<span class="string">&#x27;长白猪&#x27;</span>,<span class="string">&#x27;其他&#x27;</span>],</span><br><span class="line">    &#125;;</span><br><span class="line">&#125;,</span><br><span class="line"><span class="attr">onLoad</span>: <span class="keyword">function</span>(<span class="params"></span>) &#123;&#125;,</span><br><span class="line"><span class="attr">methods</span>: &#123;</span><br><span class="line">      <span class="title function_">bindPickerTypeChange</span>(<span class="params">e</span>) &#123;</span><br><span class="line">      	<span class="variable language_">this</span>.<span class="property">result</span>.<span class="property">type_name</span> = <span class="variable language_">this</span>.<span class="property">typearray</span>[e.<span class="property">target</span>.<span class="property">value</span>]</span><br><span class="line">      &#125;,</span><br><span class="line">&#125;		</span><br><span class="line"></span><br></pre></td></tr></table></figure>
<p>时间选择器picker的mode=”date”</p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">&quot;inputbox flcm&quot;</span>&gt;</span></span><br><span class="line">		<span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">&quot;label fsize28l&quot;</span>&gt;</span>出生日期：<span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line">        <span class="tag">&lt;<span class="name">picker</span> <span class="attr">mode</span>=<span class="string">&quot;date&quot;</span>  @<span class="attr">change</span>=<span class="string">&quot;bindDateChange&quot;</span>&gt;</span></span><br><span class="line">				<span class="tag">&lt;<span class="name">input</span> <span class="attr">type</span>=<span class="string">&quot;text&quot;</span> <span class="attr">placeholder</span>=<span class="string">&quot;输入内容&quot;</span> <span class="attr">class</span>=<span class="string">&quot;standard&quot;</span> <span class="attr">disabled</span> <span class="attr">v-model</span>=<span class="string">&quot;result.birthdate&quot;</span>/&gt;</span></span><br><span class="line">        <span class="tag">&lt;/<span class="name">picker</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br></pre></td></tr></table></figure>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="title function_">bindDateChange</span>(<span class="params">e</span>) &#123;</span><br><span class="line">    <span class="variable language_">this</span>.<span class="property">result</span>.<span class="property">birthdate</span> = e.<span class="property">target</span>.<span class="property">value</span></span><br><span class="line">    <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="variable language_">this</span>.<span class="property">nowday</span>)</span><br><span class="line">&#125;,</span><br></pre></td></tr></table></figure>
<h1 id="uniapp导航栏示例应用"><a href="#uniapp导航栏示例应用" class="headerlink" title="uniapp导航栏示例应用"></a><a target="_blank" rel="noopener" href="https://ext.dcloud.net.cn/plugin?id=1765">uniapp导航栏示例应用</a></h1><p>导航栏右上角回到首页样式</p>
<figure class="highlight json"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line"><span class="punctuation">&#123;</span></span><br><span class="line">     <span class="attr">&quot;path&quot;</span><span class="punctuation">:</span> <span class="string">&quot;pages/doctor/prescription_add_success&quot;</span><span class="punctuation">,</span></span><br><span class="line">     <span class="attr">&quot;style&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line">       <span class="attr">&quot;navigationBarTitleText&quot;</span><span class="punctuation">:</span> <span class="string">&quot;提交成功&quot;</span><span class="punctuation">,</span></span><br><span class="line">       <span class="attr">&quot;app-plus&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line">         <span class="attr">&quot;titleNView&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line">           <span class="attr">&quot;padding-right&quot;</span><span class="punctuation">:</span><span class="string">&quot;6px&quot;</span><span class="punctuation">,</span></span><br><span class="line">           <span class="attr">&quot;buttons&quot;</span><span class="punctuation">:</span> <span class="punctuation">[</span></span><br><span class="line">             <span class="punctuation">&#123;</span></span><br><span class="line">               <span class="attr">&quot;type&quot;</span><span class="punctuation">:</span><span class="string">&quot;home&quot;</span></span><br><span class="line">             <span class="punctuation">&#125;</span></span><br><span class="line">           <span class="punctuation">]</span></span><br><span class="line">         <span class="punctuation">&#125;</span></span><br><span class="line">       <span class="punctuation">&#125;</span></span><br><span class="line">     <span class="punctuation">&#125;</span></span><br><span class="line">   <span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br></pre></td></tr></table></figure>
<p>功能实现</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line">&lt;script&gt;</span><br><span class="line"><span class="keyword">export</span> <span class="keyword">default</span> &#123;</span><br><span class="line">  <span class="attr">methods</span>: &#123;</span><br><span class="line">      <span class="comment">//监听右上角点击事件</span></span><br><span class="line">      <span class="title function_">onNavigationBarButtonTap</span>(<span class="params">e</span>) &#123;</span><br><span class="line">        uni.<span class="title function_">navigateTo</span>(&#123;</span><br><span class="line">          <span class="attr">url</span>: <span class="string">&#x27;./main&#x27;</span></span><br><span class="line">        &#125;);</span><br><span class="line">      &#125;,</span><br><span class="line">      <span class="title function_">gohome</span>(<span class="params"></span>)&#123;</span><br><span class="line">        uni.<span class="title function_">navigateTo</span>(&#123;</span><br><span class="line">        	<span class="attr">url</span>: <span class="string">&#x27;./main&#x27;</span></span><br><span class="line">        &#125;);</span><br><span class="line">      &#125;</span><br><span class="line">  &#125;</span><br><span class="line">&#125;</span><br><span class="line">&lt;/script&gt;</span><br><span class="line"></span><br></pre></td></tr></table></figure>
<h1 id="filter-方法创建一个新的数组，里面元素是通过检查指定数组中符合条件的所有元素。"><a href="#filter-方法创建一个新的数组，里面元素是通过检查指定数组中符合条件的所有元素。" class="headerlink" title="filter() 方法创建一个新的数组，里面元素是通过检查指定数组中符合条件的所有元素。"></a>filter() 方法创建一个新的数组，里面元素是通过检查指定数组中符合条件的所有元素。</h1><p><strong>注意：</strong> filter() 不会对空数组进行检测。</p>
<p><strong>注意：</strong> filter() 不会改变原始数组。</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// 返回数组 ages 中所有元素都大于 18 的元素:</span></span><br><span class="line"><span class="keyword">var</span> ages = [<span class="number">32</span>, <span class="number">33</span>, <span class="number">16</span>, <span class="number">40</span>];</span><br><span class="line"></span><br><span class="line"><span class="keyword">function</span> <span class="title function_">checkAdult</span>(<span class="params">age</span>) &#123;</span><br><span class="line">    <span class="keyword">return</span> age &gt;= <span class="number">18</span>;</span><br><span class="line">&#125;</span><br><span class="line"><span class="comment">// 32,33,40</span></span><br><span class="line"><span class="keyword">function</span> <span class="title function_">myFunction</span>(<span class="params"></span>) &#123;</span><br><span class="line">    <span class="variable language_">document</span>.<span class="title function_">getElementById</span>(<span class="string">&quot;demo&quot;</span>).<span class="property">innerHTML</span> = ages.<span class="title function_">filter</span>(checkAdult);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h1 id="FinalShell云服务器命令行-文件上传下载一体"><a href="#FinalShell云服务器命令行-文件上传下载一体" class="headerlink" title="FinalShell云服务器命令行+文件上传下载一体"></a><a target="_blank" rel="noopener" href="http://www.hostbuf.com/t/988.html">FinalShell云服务器命令行+文件上传下载一体</a></h1><h1 id="uni-ui的使用"><a href="#uni-ui的使用" class="headerlink" title="uni-ui的使用"></a><a target="_blank" rel="noopener" href="https://github.com/dcloudio/uni-ui">uni-ui的使用</a></h1><p><strong>安装 uni-ui</strong></p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install @dcloudio/uni-ui</span><br></pre></td></tr></table></figure>
<p>在 <code>script</code> 中引用组件：</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> &#123;uniNoticeBar&#125; <span class="keyword">from</span> <span class="string">&#x27;@dcloudio/uni-ui&#x27;</span></span><br><span class="line"><span class="comment">//import uniNoticeBar from &#x27;@dcloudio/uni-ui/lib/uni-badge/uni-badge.vue&#x27; //也可使用此方式引入组件</span></span><br><span class="line"><span class="keyword">export</span> <span class="keyword">default</span> &#123;</span><br><span class="line">    <span class="attr">components</span>: &#123;uniNoticeBar&#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>在 <code>template</code> 中使用组件：</p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">&lt;!-- 基本用法 --&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">uni-notice-bar</span> <span class="attr">single</span>=<span class="string">&quot;true&quot;</span> <span class="attr">text</span>=<span class="string">&quot;[单行] 这是 NoticeBar 通告栏，这是 NoticeBar 通告栏，这是 NoticeBar 通告栏&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">uni-notice-bar</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">uni-notice-bar</span> <span class="attr">text</span>=<span class="string">&quot;[多行] 这是 NoticeBar 通告栏，这是 NoticeBar 通告栏，这是 NoticeBar 通告栏，这是 NoticeBar 通告栏&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">uni-notice-bar</span>&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="comment">&lt;!-- 文字滚动 --&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">uni-notice-bar</span> <span class="attr">scrollable</span>=<span class="string">&quot;true&quot;</span> <span class="attr">single</span>=<span class="string">&quot;true&quot;</span> <span class="attr">text</span>=<span class="string">&quot;[单行] 这是 NoticeBar 通告栏，这是 NoticeBar 通告栏，这是 NoticeBar 通告栏&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">uni-notice-bar</span>&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="comment">&lt;!-- 显示图标 --&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">uni-notice-bar</span> <span class="attr">showIcon</span>=<span class="string">&quot;true&quot;</span> <span class="attr">text</span>=<span class="string">&quot;[多行] 这是 NoticeBar 通告栏，这是 NoticeBar 通告栏，这是 NoticeBar 通告栏这是 NoticeBar 通告栏，这是 NoticeBar 通告栏，这是 NoticeBar 通告栏&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">uni-notice-bar</span>&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="comment">&lt;!-- 显示关闭按钮 --&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">uni-notice-bar</span> <span class="attr">showClose</span>=<span class="string">&quot;true&quot;</span> <span class="attr">showIcon</span>=<span class="string">&quot;true&quot;</span> <span class="attr">text</span>=<span class="string">&quot;这是 NoticeBar 通告栏，这是 NoticeBar 通告栏，这是 NoticeBar 通告栏&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">uni-notice-bar</span>&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="comment">&lt;!-- 查看更多 --&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">uni-notice-bar</span> @<span class="attr">getmore</span>=<span class="string">&quot;getMore&quot;</span> <span class="attr">:showGetMore</span>=<span class="string">&quot;true&quot;</span> <span class="attr">moreText</span>=<span class="string">&quot;查看更多&quot;</span> <span class="attr">single</span>=<span class="string">&quot;true&quot;</span> <span class="attr">text</span>=<span class="string">&quot;[单行] 这是 NoticeBar 通告栏，这是 NoticeBar 通告栏，这是 NoticeBar 通告栏&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">uni-notice-bar</span>&gt;</span></span><br></pre></td></tr></table></figure>
<h1 id="解决跨域"><a href="#解决跨域" class="headerlink" title="解决跨域"></a>解决跨域</h1><p>Nginx配置一下</p>
<p>反向代理</p>
<p>Webpack也可以配置：在根目录下添加vue.config.js文件，代码如下</p>
<p>注意每次修改vue.config.js文件都要npm run serve重启一遍</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line"><span class="variable language_">module</span>.<span class="property">exports</span> = &#123;</span><br><span class="line">	<span class="comment">// 打包后的根路径</span></span><br><span class="line">    <span class="attr">publicPath</span>: <span class="string">&#x27;https://gis-h5.oss-accelerate.aliyuncs.com/static&#x27;</span></span><br><span class="line">	<span class="comment">// Webpack配置解决跨域</span></span><br><span class="line">	<span class="comment">// configureWebpack:&#123;</span></span><br><span class="line">	<span class="comment">//     devServer:&#123;</span></span><br><span class="line">	<span class="comment">//       proxy:&#123;</span></span><br><span class="line">	<span class="comment">//         &#x27;/api&#x27;:&#123;</span></span><br><span class="line">	<span class="comment">//           target:&#x27;http://h5.hrkjkq.cn&#x27;,</span></span><br><span class="line">	<span class="comment">// 		  changeOrigin:true,</span></span><br><span class="line">	<span class="comment">//           pathRewrite:&#123;&quot;^/api&quot; : &quot;/api&quot;&#125;</span></span><br><span class="line">	<span class="comment">//         &#125;</span></span><br><span class="line">	<span class="comment">//       &#125;</span></span><br><span class="line">	<span class="comment">//     &#125;</span></span><br><span class="line">	<span class="comment">//   &#125;</span></span><br><span class="line">&#125;</span><br><span class="line"></span><br></pre></td></tr></table></figure>
<h1 id="uni-app-ios-苹果真机运行"><a href="#uni-app-ios-苹果真机运行" class="headerlink" title="uni-app ios 苹果真机运行"></a><a target="_blank" rel="noopener" href="https://www.cnblogs.com/yunsun/p/11506444.html">uni-app ios 苹果真机运行</a></h1><p><a href="qipanxy@gmail.com">大佬</a></p>
<p><a target="_blank" rel="noopener" href="http://www.i4.cn/">装个爱思助手就行了</a></p>
<p><a target="_blank" rel="noopener" href="https://www.jianshu.com/p/59f1818a19bc">iPhone获取设备UDID的方法</a></p>
<h1 id="上传ipa文件最新版本"><a href="#上传ipa文件最新版本" class="headerlink" title="上传ipa文件最新版本"></a>上传ipa文件最新版本</h1><p>先确定上App Store，确定Transporter和Xcode是最新版本</p>
<p>就可以在Transporter上传.ipa文件</p>
<p>最后在<a target="_blank" rel="noopener" href="https://appstoreconnect.apple.com/login">App Store Connect的网站</a>上添加新版本上传好的.ipa文件就好了</p>
<h1 id="如果需要图片响应式等比例放大缩小"><a href="#如果需要图片响应式等比例放大缩小" class="headerlink" title="如果需要图片响应式等比例放大缩小"></a>如果需要图片响应式等比例放大缩小</h1><h1 id="如何申请证书"><a href="#如何申请证书" class="headerlink" title="如何申请证书"></a><a target="_blank" rel="noopener" href="https://ask.dcloud.net.cn/article/152">如何申请证书</a></h1><h1 id="vue-element-admin"><a href="#vue-element-admin" class="headerlink" title="vue-element-admin"></a><a target="_blank" rel="noopener" href="https://panjiachen.github.io/vue-element-admin-site/zh/">vue-element-admin</a></h1><h1 id="ios-app真机测试到上架App-Store详细教程-必看"><a href="#ios-app真机测试到上架App-Store详细教程-必看" class="headerlink" title="ios app真机测试到上架App Store详细教程-必看"></a><a target="_blank" rel="noopener" href="http://blog.applicationloader.net/blog/zh/88.html">ios app真机测试到上架App Store详细教程-必看</a></h1><p><img src= "/web/img/loading.gif" data-lazy-src="/img/未越狱.png" alt="9"></p>
<h1 id="mumu模拟器运行会遇到这种情况，真机运行正常"><a href="#mumu模拟器运行会遇到这种情况，真机运行正常" class="headerlink" title="mumu模拟器运行会遇到这种情况，真机运行正常"></a>mumu模拟器运行会遇到这种情况，真机运行正常</h1><p><img src= "/web/img/loading.gif" data-lazy-src="/img/code1.png" alt="10"></p>
<p>打包遇到了，再配置项中勾选了一个，就没事了</p>
<p><img src= "/web/img/loading.gif" data-lazy-src="/img/code2.png" alt="11"></p>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">文章作者: </span><span class="post-copyright-info"><a href="mailto:undefined">ZhuoRu</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">文章链接: </span><span class="post-copyright-info"><a href="https://zhangzhuoru.gitee.io/web/post/11314.html">https://zhangzhuoru.gitee.io/web/post/11314.html</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="https://zhangzhuoru.gitee.io/web" target="_blank">前端攻城狮ZhuoRu</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/web/tags/uniapp/">uniapp</a></div><div class="post_share"><div class="social-share" data-image="/web/img/tab5.png" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/social-share.js/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/social-share.js/dist/js/social-share.min.js" defer></script></div></div><div class="post-reward"><div class="reward-button button--animated"><i class="fas fa-qrcode"></i> 打赏</div><div class="reward-main"><ul class="reward-all"><li class="reward-item"><a href="/web/./img/wechat.png" target="_blank"><img class="post-qr-code-img" data-lazy-src="/web/./img/wechat.png" alt="微信"/></a><div class="post-qr-code-desc">微信</div></li><li class="reward-item"><a href="/web/./img/alipay.jpg" target="_blank"><img class="post-qr-code-img" data-lazy-src="/web/./img/alipay.jpg" alt="支付寶"/></a><div class="post-qr-code-desc">支付寶</div></li></ul></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/web/post/16106.html"><img class="prev-cover" data-lazy-src="/web/img/tab99.png" onerror="onerror=null;src='/web/img/404.jpg'" alt="cover of previous post"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">填坑录</div></div></a></div><div class="next-post pull-right"><a href="/web/post/16107.html"><img class="next-cover" data-lazy-src="/web/img/tab6.png" onerror="onerror=null;src='/web/img/404.jpg'" alt="cover of next post"><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">Butterfly启动说明书</div></div></a></div></nav><hr/><div id="post-comment"><div class="comment-head"><div class="comment-headline"><i class="fas fa-comments fa-fw"></i><span> 评论</span></div></div><div class="comment-wrap"><div><div id="twikoo-wrap"></div></div></div></div></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="card-info-avatar is-center"><img class="avatar-img" data-lazy-src="https://thirdqq.qlogo.cn/g?b=sdk&amp;nk=2276839311&amp;s=140" onerror="this.onerror=null;this.src='/web/img/friend_404.gif'" alt="avatar"/><div class="author-info__name">ZhuoRu</div><div class="author-info__description"></div></div><div class="card-info-data"><div class="card-info-data-item is-center"><a href="/web/archives/"><div class="headline">文章</div><div class="length-num">8</div></a></div><div class="card-info-data-item is-center"><a href="/web/tags/"><div class="headline">标签</div><div class="length-num">9</div></a></div><div class="card-info-data-item is-center"><a href="/web/categories/"><div class="headline">分类</div><div class="length-num">5</div></a></div></div><a class="button--animated" id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/WebZhuoRu"><i class="fab fa-github"></i><span>Follow Me</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://github.com/WebZhuoRu" target="_blank" title="Github"><i class="fab fa-github"></i></a><a class="social-icon" href="mailto:2276839311@qq.com" target="_blank" title="Email"><i class="fas fa-envelope"></i></a><a class="social-icon" href="https://webzhuoru.github.io/" target="_blank" title="博客"><i class="fa-solid fa-book-skull"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn card-announcement-animation"></i><span>公告</span></div><div class="announcement_content">This is my Blog</div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#%E7%99%BB%E5%BD%95%E8%BE%93%E5%85%A5%E6%A1%86%E6%A0%B7%E5%BC%8F"><span class="toc-number">1.</span> <span class="toc-text">登录输入框样式</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%80%92%E8%AE%A1%E6%97%B6"><span class="toc-number">2.</span> <span class="toc-text">倒计时</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#uniappAndroid%E5%BE%AE%E4%BF%A1%E6%94%AF%E4%BB%98"><span class="toc-number">3.</span> <span class="toc-text">uniappAndroid微信支付</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#uniapp%E9%98%BB%E6%AD%A2%E4%BA%8B%E4%BB%B6%E5%86%92%E6%B3%A1-click-stop%E5%A4%B1%E6%95%88"><span class="toc-number">4.</span> <span class="toc-text">uniapp阻止事件冒泡@click.stop失效</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%85%B3%E4%BA%8Evue-%E9%87%8C-class-%E7%9A%84%E5%87%A0%E7%A7%8D%E4%BD%BF%E7%94%A8%E6%96%B9%E5%BC%8F"><span class="toc-number">5.</span> <span class="toc-text">关于vue 里:class 的几种使用方式</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#CSS-%E4%BC%AA%E7%B1%BB-not-%E7%94%A8%E6%9D%A5%E5%8C%B9%E9%85%8D%E4%B8%8D%E7%AC%A6%E5%90%88%E4%B8%80%E7%BB%84%E9%80%89%E6%8B%A9%E5%99%A8%E7%9A%84%E5%85%83%E7%B4%A0%E3%80%82%E7%94%B1%E4%BA%8E%E5%AE%83%E7%9A%84%E4%BD%9C%E7%94%A8%E6%98%AF%E9%98%B2%E6%AD%A2%E7%89%B9%E5%AE%9A%E7%9A%84%E5%85%83%E7%B4%A0%E8%A2%AB%E9%80%89%E4%B8%AD%EF%BC%8C%E5%AE%83%E4%B9%9F%E8%A2%AB%E7%A7%B0%E4%B8%BA%E5%8F%8D%E9%80%89%E4%BC%AA%E7%B1%BB%EF%BC%88negation-pseudo-class%EF%BC%89%E3%80%82"><span class="toc-number">6.</span> <span class="toc-text">CSS 伪类 :not() 用来匹配不符合一组选择器的元素。由于它的作用是防止特定的元素被选中，它也被称为反选伪类（negation pseudo-class）。</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#vue%E9%A1%B9%E7%9B%AE%E4%B8%AD%E4%BD%BF%E7%94%A8scss-sass"><span class="toc-number">7.</span> <span class="toc-text">vue项目中使用scss&#x2F;sass</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#JS%E4%B8%ADfind%E6%96%B9%E6%B3%95"><span class="toc-number">8.</span> <span class="toc-text">JS中find方法</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E7%94%A8%E6%B3%95"><span class="toc-number">8.0.1.</span> <span class="toc-text">用法</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%AE%9E%E4%BE%8B"><span class="toc-number">8.0.2.</span> <span class="toc-text">实例</span></a></li></ol></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#javascript%E8%8E%B7%E5%8F%96url%E5%8F%82%E6%95%B0"><span class="toc-number">9.</span> <span class="toc-text">javascript获取url参数</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#uniapp%E8%BF%9B%E5%BA%A6%E6%9D%A1"><span class="toc-number">10.</span> <span class="toc-text">uniapp进度条</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#JS%E5%A6%82%E4%BD%95%E5%88%A4%E6%96%AD%E4%B8%80%E4%B8%AA%E6%95%B0%E7%BB%84%E6%98%AF%E5%90%A6%E4%B8%BA%E7%A9%BA%E3%80%81%E6%98%AF%E5%90%A6%E5%90%AB%E6%9C%89%E6%9F%90%E4%B8%AA%E5%80%BC"><span class="toc-number">11.</span> <span class="toc-text">JS如何判断一个数组是否为空、是否含有某个值</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#vue%E9%A1%B9%E7%9B%AE%E5%88%B7%E6%96%B0%E5%BD%93%E5%89%8D%E9%A1%B5%E9%9D%A2%E7%9A%84%E4%B8%89%E7%A7%8D%E6%96%B9%E6%B3%95"><span class="toc-number">12.</span> <span class="toc-text">vue项目刷新当前页面的三种方法</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#JS-%E5%AD%97%E7%AC%A6%E4%B8%B2%E6%88%AA%E5%8F%96%E6%96%B9%E6%B3%95%E6%B1%87%E6%80%BB%EF%BC%88slice%E3%80%81substring%E3%80%81substr%E7%AD%89%EF%BC%89"><span class="toc-number">13.</span> <span class="toc-text">JS - 字符串截取方法汇总（slice、substring、substr等）</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#1%E3%80%81%E4%BD%BF%E7%94%A8-slice-%E6%88%AA%E5%8F%96"><span class="toc-number">13.0.1.</span> <span class="toc-text">1、使用 slice() 截取</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#1%EF%BC%8C%E5%87%BD%E6%95%B0%E8%AF%B4%E6%98%8E"><span class="toc-number">13.0.1.1.</span> <span class="toc-text">1，函数说明</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2%EF%BC%8C%E4%BD%BF%E7%94%A8%E6%A0%B7%E4%BE%8B"><span class="toc-number">13.0.2.</span> <span class="toc-text">2，使用样例</span></a></li></ol></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%85%8D%E8%B4%B9%E5%9C%A8%E7%BA%BF%E6%9D%A1%E5%BD%A2%E7%A0%81%E7%94%9F%E6%88%90%E5%99%A8-%E6%9D%A1%E7%A0%81%E7%94%9F%E6%88%90%E5%88%B6%E4%BD%9C%E5%B7%A5%E5%85%B7"><span class="toc-number">14.</span> <span class="toc-text">免费在线条形码生成器-条码生成制作工具</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#js-%E6%97%B6%E9%97%B4%E6%88%B3%E8%BD%AC%E4%B8%BA%E6%97%A5%E6%9C%9F%E6%A0%BC%E5%BC%8F"><span class="toc-number">15.</span> <span class="toc-text">js 时间戳转为日期格式</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#vue-%E5%86%85%E8%81%94%E6%A0%B7%E5%BC%8Fstyle%E4%B8%AD%E7%9A%84background"><span class="toc-number">16.</span> <span class="toc-text">vue 内联样式style中的background</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%9C%9F%E8%B1%86%E5%9B%BE%E5%BA%8A"><span class="toc-number">17.</span> <span class="toc-text">土豆图床</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#uni-%E8%AE%BE%E7%BD%AEplaceholder%E9%A2%9C%E8%89%B2"><span class="toc-number">18.</span> <span class="toc-text">uni 设置placeholder颜色</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#uniapp%E7%9B%91%E5%90%ACwebview%E5%80%BC%E7%9A%84%E5%8F%98%E5%8A%A8%EF%BC%88%E5%BC%95%E5%85%A5%E9%A1%B5%E9%9D%A2%E7%9A%84title%EF%BC%89"><span class="toc-number">19.</span> <span class="toc-text">uniapp监听webview值的变动（引入页面的title）</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#uni-app-%E6%89%93%E5%BC%80%E5%A4%96%E9%93%BE%E7%BD%91%E5%9D%80%E5%92%8C%E6%89%93%E5%BC%80%E5%86%85%E9%83%A8%E7%BD%91%E9%A1%B5%E7%9A%84%E6%96%B9%E6%B3%95"><span class="toc-number">20.</span> <span class="toc-text">uni-app 打开外链网址和打开内部网页的方法</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%B0%8F%E7%A8%8B%E5%BA%8F-%E5%9C%A8%E6%89%8B%E6%9C%BA%E4%B8%8A%E5%A6%82%E6%9E%9C%E4%B8%8D%E6%89%93%E5%BC%80%E8%B0%83%E8%AF%95%E6%A8%A1%E5%BC%8F-%E4%B8%8D%E8%83%BD%E6%AD%A3%E5%B8%B8%E8%AF%B7%E6%B1%82%E6%8E%A5%E5%8F%A3-%E6%89%93%E5%BC%80%E8%B0%83%E8%AF%95%E6%A8%A1%E8%AF%95%E5%B0%B1%E5%8F%AF%E4%BB%A5%E6%AD%A3%E5%B8%B8%E8%AF%B7%E6%B1%82-%E7%9C%9F%E6%9C%BA%E6%B5%8B%E8%AF%95%E5%92%8C%E5%BC%80%E5%8F%91%E8%80%85%E5%B7%A5%E5%85%B7%E9%83%BD%E5%8F%AF%E4%BB%A5%E6%AD%A3%E5%B8%B8%E6%98%BE%E7%A4%BA"><span class="toc-number">21.</span> <span class="toc-text">小程序:在手机上如果不打开调试模式,不能正常请求接口,打开调试模试就可以正常请求,真机测试和开发者工具都可以正常显示</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#JS%E4%B8%AD%E5%AF%B9%E8%B1%A1%E8%BD%AC%E6%95%B0%E7%BB%84%E6%96%B9%E6%B3%95%E6%80%BB%E7%BB%93"><span class="toc-number">22.</span> <span class="toc-text">JS中对象转数组方法总结</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#js-%E5%88%A4%E6%96%AD%E6%98%AF%E5%90%A6%E4%B8%BA%E7%A9%BA%E5%AF%B9%E8%B1%A1%E3%80%81%E7%A9%BA%E6%95%B0%E7%BB%84"><span class="toc-number">23.</span> <span class="toc-text">js 判断是否为空对象、空数组</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%BE%AE%E4%BF%A1%E5%B0%8F%E7%A8%8B%E5%BA%8F%E5%BC%95%E7%94%A8%E9%A1%B5%E9%9D%A2%E8%B0%83%E7%94%A8%E7%BB%84%E4%BB%B6%E5%86%85%E7%9A%84%E6%96%B9%E6%B3%95%EF%BC%88%E7%88%B6%E7%BB%84%E4%BB%B6%E8%B0%83%E7%94%A8%E5%AD%90%E7%BB%84%E4%BB%B6%E7%9A%84%E6%96%B9%E6%B3%95%EF%BC%89"><span class="toc-number">24.</span> <span class="toc-text">微信小程序引用页面调用组件内的方法（父组件调用子组件的方法）</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E6%B5%85%E8%B0%88%E5%89%8D%E7%AB%AF%E5%B8%B8%E8%A7%81%E7%9A%84%E6%95%B0%E7%BB%84%E5%92%8C%E5%AF%B9%E8%B1%A1%E7%9A%84%E9%81%8D%E5%8E%86%E9%97%AE%E9%A2%98"><span class="toc-number">25.</span> <span class="toc-text">浅谈前端常见的数组和对象的遍历问题</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#CSS%E6%96%87%E6%9C%AC%E6%BA%A2%E5%87%BA%E6%98%BE%E7%A4%BA%E7%9C%81%E7%95%A5%E5%8F%B7"><span class="toc-number">26.</span> <span class="toc-text">CSS文本溢出显示省略号</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%BE%AE%E4%BF%A1%E5%B0%8F%E7%A8%8B%E5%BA%8F%E5%88%86%E4%BA%AB%E5%8A%9F%E8%83%BD"><span class="toc-number">27.</span> <span class="toc-text">微信小程序分享功能</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%BE%AE%E4%BF%A1%E5%B0%8F%E7%A8%8B%E5%BA%8F%E5%88%86%E4%BA%AB%E4%BA%8C%E7%BB%B4%E7%A0%81%E8%83%8C%E6%99%AF%E5%9B%BE%EF%BC%8C%E5%B9%B6%E8%87%AA%E5%8A%A8%E4%BF%9D%E5%AD%98%E4%B8%8B%E8%BD%BD%E4%B8%8B%E6%9D%A5"><span class="toc-number">28.</span> <span class="toc-text">微信小程序分享二维码背景图，并自动保存下载下来</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#uni-app-%E4%B8%AD%E4%BF%9D%E6%8C%81%E7%94%A8%E6%88%B7%E7%99%BB%E5%BD%95%E7%8A%B6%E6%80%81"><span class="toc-number">29.</span> <span class="toc-text">uni-app 中保持用户登录状态</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#uniapp%E6%A0%87%E9%A2%98%E4%B8%8D%E6%83%B3%E8%A6%81%E8%BF%94%E5%9B%9E%E6%8C%89%E9%92%AE-lt"><span class="toc-number">30.</span> <span class="toc-text">uniapp标题不想要返回按钮 &lt;</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E6%89%AB%E7%A0%81%E7%99%BB%E8%AE%B0"><span class="toc-number">31.</span> <span class="toc-text">扫码登记</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E8%8E%B7%E5%8F%96%E5%BD%93%E5%89%8D%E5%B9%B4%E6%9C%88%E6%97%A5"><span class="toc-number">32.</span> <span class="toc-text">获取当前年月日</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#uniapp%E5%BD%93%E5%89%8D%E8%BF%9B%E5%B1%82%E7%BA%A7%E5%A4%AA%E6%B7%B1%E6%97%B6%EF%BC%8C%E6%8B%A6%E6%88%AA%E7%9B%91%E5%90%AC%EF%BC%8C%E9%87%8D%E5%AE%9A%E5%90%91"><span class="toc-number">33.</span> <span class="toc-text">uniapp当前进层级太深时，拦截监听，重定向</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#uniapp%E4%B8%8B%E6%8B%89%E9%80%89%E6%8B%A9"><span class="toc-number">34.</span> <span class="toc-text">uniapp下拉选择</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#uniapp%E5%AF%BC%E8%88%AA%E6%A0%8F%E7%A4%BA%E4%BE%8B%E5%BA%94%E7%94%A8"><span class="toc-number">35.</span> <span class="toc-text">uniapp导航栏示例应用</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#filter-%E6%96%B9%E6%B3%95%E5%88%9B%E5%BB%BA%E4%B8%80%E4%B8%AA%E6%96%B0%E7%9A%84%E6%95%B0%E7%BB%84%EF%BC%8C%E9%87%8C%E9%9D%A2%E5%85%83%E7%B4%A0%E6%98%AF%E9%80%9A%E8%BF%87%E6%A3%80%E6%9F%A5%E6%8C%87%E5%AE%9A%E6%95%B0%E7%BB%84%E4%B8%AD%E7%AC%A6%E5%90%88%E6%9D%A1%E4%BB%B6%E7%9A%84%E6%89%80%E6%9C%89%E5%85%83%E7%B4%A0%E3%80%82"><span class="toc-number">36.</span> <span class="toc-text">filter() 方法创建一个新的数组，里面元素是通过检查指定数组中符合条件的所有元素。</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#FinalShell%E4%BA%91%E6%9C%8D%E5%8A%A1%E5%99%A8%E5%91%BD%E4%BB%A4%E8%A1%8C-%E6%96%87%E4%BB%B6%E4%B8%8A%E4%BC%A0%E4%B8%8B%E8%BD%BD%E4%B8%80%E4%BD%93"><span class="toc-number">37.</span> <span class="toc-text">FinalShell云服务器命令行+文件上传下载一体</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#uni-ui%E7%9A%84%E4%BD%BF%E7%94%A8"><span class="toc-number">38.</span> <span class="toc-text">uni-ui的使用</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E8%A7%A3%E5%86%B3%E8%B7%A8%E5%9F%9F"><span class="toc-number">39.</span> <span class="toc-text">解决跨域</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#uni-app-ios-%E8%8B%B9%E6%9E%9C%E7%9C%9F%E6%9C%BA%E8%BF%90%E8%A1%8C"><span class="toc-number">40.</span> <span class="toc-text">uni-app ios 苹果真机运行</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E4%B8%8A%E4%BC%A0ipa%E6%96%87%E4%BB%B6%E6%9C%80%E6%96%B0%E7%89%88%E6%9C%AC"><span class="toc-number">41.</span> <span class="toc-text">上传ipa文件最新版本</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%A6%82%E6%9E%9C%E9%9C%80%E8%A6%81%E5%9B%BE%E7%89%87%E5%93%8D%E5%BA%94%E5%BC%8F%E7%AD%89%E6%AF%94%E4%BE%8B%E6%94%BE%E5%A4%A7%E7%BC%A9%E5%B0%8F"><span class="toc-number">42.</span> <span class="toc-text">如果需要图片响应式等比例放大缩小</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%A6%82%E4%BD%95%E7%94%B3%E8%AF%B7%E8%AF%81%E4%B9%A6"><span class="toc-number">43.</span> <span class="toc-text">如何申请证书</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#vue-element-admin"><span class="toc-number">44.</span> <span class="toc-text">vue-element-admin</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#ios-app%E7%9C%9F%E6%9C%BA%E6%B5%8B%E8%AF%95%E5%88%B0%E4%B8%8A%E6%9E%B6App-Store%E8%AF%A6%E7%BB%86%E6%95%99%E7%A8%8B-%E5%BF%85%E7%9C%8B"><span class="toc-number">45.</span> <span class="toc-text">ios app真机测试到上架App Store详细教程-必看</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#mumu%E6%A8%A1%E6%8B%9F%E5%99%A8%E8%BF%90%E8%A1%8C%E4%BC%9A%E9%81%87%E5%88%B0%E8%BF%99%E7%A7%8D%E6%83%85%E5%86%B5%EF%BC%8C%E7%9C%9F%E6%9C%BA%E8%BF%90%E8%A1%8C%E6%AD%A3%E5%B8%B8"><span class="toc-number">46.</span> <span class="toc-text">mumu模拟器运行会遇到这种情况，真机运行正常</span></a></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/web/post/1026.html" title="Vue3学习总结"><img data-lazy-src="/web/img/tab99.png" onerror="this.onerror=null;this.src='/web/img/404.jpg'" alt="Vue3学习总结"/></a><div class="content"><a class="title" href="/web/post/1026.html" title="Vue3学习总结">Vue3学习总结</a><time datetime="2022-11-26T16:31:04.834Z" title="发表于 2022-11-27 00:31:04">2022-11-27</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/web/post/1666.html" title="个人简历大全 😘"><img data-lazy-src="/web/img/tab4.png" onerror="this.onerror=null;this.src='/web/img/404.jpg'" alt="个人简历大全 😘"/></a><div class="content"><a class="title" href="/web/post/1666.html" title="个人简历大全 😘">个人简历大全 😘</a><time datetime="2022-11-26T16:31:04.810Z" title="发表于 2022-11-27 00:31:04">2022-11-27</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/web/post/1024.html" title="话费充值平台总结"><img data-lazy-src="/web/img/tab2.png" onerror="this.onerror=null;this.src='/web/img/404.jpg'" alt="话费充值平台总结"/></a><div class="content"><a class="title" href="/web/post/1024.html" title="话费充值平台总结">话费充值平台总结</a><time datetime="2022-11-26T16:31:04.798Z" title="发表于 2022-11-27 00:31:04">2022-11-27</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/web/post/16106.html" title="填坑录"><img data-lazy-src="/web/img/tab99.png" onerror="this.onerror=null;this.src='/web/img/404.jpg'" alt="填坑录"/></a><div class="content"><a class="title" href="/web/post/16106.html" title="填坑录">填坑录</a><time datetime="2022-11-26T16:31:04.787Z" title="发表于 2022-11-27 00:31:04">2022-11-27</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/web/post/11314.html" title="uniapp开发,遇坑填坑 😘"><img data-lazy-src="/web/img/tab5.png" onerror="this.onerror=null;this.src='/web/img/404.jpg'" alt="uniapp开发,遇坑填坑 😘"/></a><div class="content"><a class="title" href="/web/post/11314.html" title="uniapp开发,遇坑填坑 😘">uniapp开发,遇坑填坑 😘</a><time datetime="2022-11-26T16:31:04.746Z" title="发表于 2022-11-27 00:31:04">2022-11-27</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/web/post/16107.html" title="Butterfly启动说明书"><img data-lazy-src="/web/img/tab6.png" onerror="this.onerror=null;this.src='/web/img/404.jpg'" alt="Butterfly启动说明书"/></a><div class="content"><a class="title" href="/web/post/16107.html" title="Butterfly启动说明书">Butterfly启动说明书</a><time datetime="2022-11-26T16:31:04.729Z" title="发表于 2022-11-27 00:31:04">2022-11-27</time></div></div></div></div></div></div></main><footer id="footer" style="background-image: url('/web/img/tab5.png')"><div id="footer-wrap"><div class="copyright">&copy;2019 - 2022 By ZhuoRu</div><div class="footer_custom_text">I wish you to become your own sun, no need to rely on who's light.<p><a target="_blank" href="https://hexo.io/"><img src="https://img.shields.io/badge/Frame-Hexo-blue?style=flat&logo=hexo" title="博客框架为Hexo"></a>&nbsp;<a target="_blank" href="https://butterfly.js.org/"><img src="https://img.shields.io/badge/Theme-Butterfly-6513df?style=flat&logo=bitdefender" title="主题采用butterfly"></a>&nbsp;<a target="_blank" href="https://www.jsdelivr.com/"><img src="https://img.shields.io/badge/CDN-jsDelivr-orange?style=flat&logo=jsDelivr" title="本站使用JsDelivr为静态资源提供CDN加速"></a> &nbsp;<a target="_blank" href="https://vercel.com/ "><img src="https://img.shields.io/badge/Hosted-Vervel-brightgreen?style=flat&logo=Vercel" title="本站采用双线部署，默认线路托管于Vercel"></a>&nbsp;<a target="_blank" href="https://vercel.com/ "><img src="https://img.shields.io/badge/Hosted-Coding-0cedbe?style=flat&logo=Codio" title="本站采用双线部署，联通线路托管于Coding"></a>&nbsp;<a target="_blank" href="https://github.com/"><img src="https://img.shields.io/badge/Source-Github-d021d6?style=flat&logo=GitHub" title="本站项目由Gtihub托管"></a>&nbsp;<a target="_blank" href="http://creativecommons.org/licenses/by-nc-sa/4.0/"><img src="https://img.shields.io/badge/Copyright-BY--NC--SA%204.0-d42328?style=flat&logo=Claris" title="本站采用知识共享署名-非商业性使用-相同方式共享4.0国际许可协议进行许可"></a></p></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><a class="icon-V hidden" onclick="switchNightMode()" title="浅色和深色模式转换"><svg width="25" height="25" viewBox="0 0 1024 1024"><use id="modeicon" xlink:href="#icon-moon"></use></svg></a><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><a id="to_comment" href="#post-comment" title="直达评论"><i class="fas fa-comments"></i></a><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div id="local-search"><div class="search-dialog"><div class="search-dialog__title" id="local-search-title">本地搜索</div><div id="local-input-panel"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"/></div></div></div><hr/><div id="local-search-results"></div><span class="search-close-button"><i class="fas fa-times"></i></span></div><div id="search-mask"></div></div><div><script src="/web/js/utils.js"></script><script src="/web/js/main.js"></script><script src="https://cdn.jsdelivr.net/npm/vanilla-lazyload/dist/lazyload.iife.min.js"></script><script src="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.js"></script><script src="/web/js/search/local-search.js"></script><script>var preloader = {
  endLoading: () => {
    document.body.style.overflow = 'auto';
    document.getElementById('loading-box').classList.add("loaded")
  },
  initLoading: () => {
    document.body.style.overflow = '';
    document.getElementById('loading-box').classList.remove("loaded")

  }
}
window.addEventListener('load',preloader.endLoading())</script><div class="js-pjax"><script>(()=>{
  const $countDom = document.getElementById('twikoo-count')
  const init = () => {
    twikoo.init(Object.assign({
      el: '#twikoo-wrap',
      envId: 'https://wechat-delta.vercel.app/',
      region: 'ap-guangzhou'
    }, null))
  }

  const getCount = () => {
    twikoo.getCommentsCount({
      envId: 'https://wechat-delta.vercel.app/',
      region: 'ap-guangzhou',
      urls: [window.location.pathname],
      includeReply: false
    }).then(function (res) {
      $countDom.innerText = res[0].count
    }).catch(function (err) {
      console.error(err);
    });
  }

  const loadTwikoo = (bool = false) => {
    if (typeof twikoo === 'object') {
      init()
      bool && $countDom && setTimeout(getCount,0)
    } else {
      getScript('https://cdn.jsdelivr.net/npm/twikoo/dist/twikoo.all.min.js').then(()=> {
        init()
        bool && $countDom && setTimeout(getCount,0)
      })
    }
  }

  if ('Twikoo' === 'Twikoo' || !true) {
    if (true) btf.loadComment(document.getElementById('twikoo-wrap'), loadTwikoo)
    else loadTwikoo(true)
  } else {
    window.loadOtherComment = () => {
      loadTwikoo()
    }
  }
})()</script></div><canvas id="universe"></canvas><div class="aplayer no-destroy" data-id="7592292364" data-server="netease" data-type="playlist" data-fixed="true" data-autoplay="true" data-loop="all" data-lrctype="0"> </div><script defer src="https://npm.elemecdn.com/jquery@latest/dist/jquery.min.js"></script><script defer src="./js/universe.js"></script><script defer src="./js/sun_moon.js"></script><script defer src="https://fastly.jsdelivr.net/gh/graingert/wow@1.3.0/dist/wow.min.js"></script><script defer data-pjax src="/js/wow_init.js"></script><script defer src="https://fastly.jsdelivr.net/npm/hexo-theme-volantis@latest/source/js/issues.min.js"></script><canvas class="fireworks" mobile="false"></canvas><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/fireworks.min.js"></script><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/activate-power-mode.min.js"></script><script>POWERMODE.colorful = true;
POWERMODE.shake = false;
POWERMODE.mobile = false;
document.body.addEventListener('input', POWERMODE);
</script><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js"></script><script src="https://cdn.jsdelivr.net/gh/metowolf/MetingJS@1.2/dist/Meting.min.js"></script><script src="https://cdn.jsdelivr.net/npm/pjax/pjax.min.js"></script><script>let pjaxSelectors = [
  'title',
  '#config-diff',
  '#body-wrap',
  '#rightside-config-hide',
  '#rightside-config-show',
  '.js-pjax'
]

if (false) {
  pjaxSelectors.unshift('meta[property="og:image"]', 'meta[property="og:title"]', 'meta[property="og:url"]')
}

var pjax = new Pjax({
  elements: 'a:not([target="_blank"])',
  selectors: pjaxSelectors,
  cacheBust: false,
  analytics: false,
  scrollRestoration: false
})

document.addEventListener('pjax:complete', function () {
  window.refreshFn()

  document.querySelectorAll('script[data-pjax]').forEach(item => {
    const newScript = document.createElement('script')
    const content = item.text || item.textContent || item.innerHTML || ""
    Array.from(item.attributes).forEach(attr => newScript.setAttribute(attr.name, attr.value))
    newScript.appendChild(document.createTextNode(content))
    item.parentNode.replaceChild(newScript, item)
  })

  GLOBAL_CONFIG.islazyload && window.lazyLoadInstance.update()

  typeof chatBtnFn === 'function' && chatBtnFn()
  typeof panguInit === 'function' && panguInit()

  // google analytics
  typeof gtag === 'function' && gtag('config', '', {'page_path': window.location.pathname});

  // baidu analytics
  typeof _hmt === 'object' && _hmt.push(['_trackPageview',window.location.pathname]);

  typeof loadMeting === 'function' && document.getElementsByClassName('aplayer').length && loadMeting()

  // Analytics
  if (false) {
    MtaH5.pgv()
  }

  // prismjs
  typeof Prism === 'object' && Prism.highlightAll()

  typeof preloader === 'object' && preloader.endLoading()
})


document.addEventListener('pjax:send', function () {
  typeof preloader === 'object' && preloader.initLoading()
  
  if (window.aplayers) {
    for (let i = 0; i < window.aplayers.length; i++) {
      if (!window.aplayers[i].options.fixed) {
        window.aplayers[i].destroy()
      }
    }
  }

  typeof typed === 'object' && typed.destroy()

  //reset readmode
  const $bodyClassList = document.body.classList
  $bodyClassList.contains('read-mode') && $bodyClassList.remove('read-mode')

})

document.addEventListener('pjax:error', (e) => {
  if (e.request.status === 404) {
    pjax.loadUrl('/404.html')
  }
})</script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div><!-- hexo injector body_end start --><script data-pjax>
  function butterfly_swiper_injector_config(){
    var parent_div_git = document.getElementById('recent-posts');
    var item_html = '<div class="recent-post-item" style="height: auto;width: 100%"><div class="blog-slider swiper-container-fade swiper-container-horizontal" id="swiper_container"><div class="blog-slider__wrp swiper-wrapper" style="transition-duration: 0ms;"><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><a class="blog-slider__img" onclick="pjax.loadUrl(&quot;post/1026.html&quot;);" href="javascript:void(0);" alt=""><img width="48" height="48" src="/img/tab99.png" alt="" onerror="this.src=https://unpkg.zhimg.com/akilar-candyassets/image/loading.gif; this.onerror = null;"/></a><div class="blog-slider__content"><span class="blog-slider__code">2022-11-27</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;post/1026.html&quot;);" href="javascript:void(0);" alt="">Vue3学习总结</a><div class="blog-slider__text">前端内卷的开始,Vue3开发上手总结</div><a class="blog-slider__button" onclick="pjax.loadUrl(&quot;post/1026.html&quot;);" href="javascript:void(0);" alt="">详情       </a></div></div><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><a class="blog-slider__img" onclick="pjax.loadUrl(&quot;post/1038.html&quot;);" href="javascript:void(0);" alt=""><img width="48" height="48" src="/img/tab5.png" alt="" onerror="this.src=https://unpkg.zhimg.com/akilar-candyassets/image/loading.gif; this.onerror = null;"/></a><div class="blog-slider__content"><span class="blog-slider__code">2022-11-27</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;post/1038.html&quot;);" href="javascript:void(0);" alt="">css学习总结</a><div class="blog-slider__text">课程目标:1. 学会使用CSS选择器2. 熟记CSS样式和外观属性3. 熟练掌握CSS各种选择器4. 熟练掌握CSS各种选择器5. 熟练掌握CSS三种显示模式6. 熟练掌握CSS背景属性7. 熟练掌握CSS三大特性8. 熟练掌握CSS盒子模型9. 熟练掌握CSS浮动10.熟练掌握CSS定位11.熟练掌握CSS高级技巧强化CSS</div><a class="blog-slider__button" onclick="pjax.loadUrl(&quot;post/1038.html&quot;);" href="javascript:void(0);" alt="">详情       </a></div></div><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><a class="blog-slider__img" onclick="pjax.loadUrl(&quot;post/16107.html&quot;);" href="javascript:void(0);" alt=""><img width="48" height="48" src="/img/tab6.png" alt="" onerror="this.src=https://unpkg.zhimg.com/akilar-candyassets/image/loading.gif; this.onerror = null;"/></a><div class="blog-slider__content"><span class="blog-slider__code">2022-11-27</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;post/16107.html&quot;);" href="javascript:void(0);" alt="">Butterfly启动说明书</a><div class="blog-slider__text">启动说明书</div><a class="blog-slider__button" onclick="pjax.loadUrl(&quot;post/16107.html&quot;);" href="javascript:void(0);" alt="">详情       </a></div></div><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><a class="blog-slider__img" onclick="pjax.loadUrl(&quot;post/2020715.html&quot;);" href="javascript:void(0);" alt=""><img width="48" height="48" src="/img/tab2.png" alt="" onerror="this.src=https://unpkg.zhimg.com/akilar-candyassets/image/loading.gif; this.onerror = null;"/></a><div class="blog-slider__content"><span class="blog-slider__code">2022-11-27</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;post/2020715.html&quot;);" href="javascript:void(0);" alt="">html学习总结</a><div class="blog-slider__text">学习目标:了解常用浏览器;掌握WEB标准;理解标签语义化;掌握常用的排版标签;掌握常用的文本格式化图像链接等标签;掌握三种列表标签;掌握表格标签;掌握表格标签;掌握表单标签</div><a class="blog-slider__button" onclick="pjax.loadUrl(&quot;post/2020715.html&quot;);" href="javascript:void(0);" alt="">详情       </a></div></div></div><div class="blog-slider__pagination swiper-pagination-clickable swiper-pagination-bullets"></div></div></div>';
    console.log('已挂载butterfly_swiper')
    parent_div_git.insertAdjacentHTML("afterbegin",item_html)
    }
  var elist = 'undefined'.split(',');
  var cpage = location.pathname;
  var epage = 'all';
  var flag = 0;

  for (var i=0;i<elist.length;i++){
    if (cpage.includes(elist[i])){
      flag++;
    }
  }

  if ((epage ==='all')&&(flag == 0)){
    butterfly_swiper_injector_config();
  }
  else if (epage === cpage){
    butterfly_swiper_injector_config();
  }
  </script><script defer src="https://npm.elemecdn.com/hexo-butterfly-swiper/lib/swiper.min.js"></script><script defer data-pjax src="https://npm.elemecdn.com/hexo-butterfly-swiper/lib/swiper_init.js"></script><script async src="//at.alicdn.com/t/font_2032782_8d5kxvn09md.js"></script><!-- hexo injector body_end end --></body></html>